On Thursday 18 February 2010 11:42:38 Sylvain Thénault wrote:
> On 18 février 11:40, Emile Anclin wrote:
> > On Thursday 18 February 2010 11:21:55 Sylvain Thénault wrote:
> > > > I guess, you should actually add a *visit_assert* and check the
> > > > type of 'test' :
> > > >
> > > >     def visit_assert(self, node):
> > > >         if isinstance(node.test, astng.Tuple):
> > > >            that_s_bad()
> > >
> > > that's not enough, we should ensure that
> > >
> > >  raise (a, b), 'bad'
> > >
> > > don't trigger the message
> >
> > I thought, we are talking about *assert*, not *raise* ?
>
> oops
>
> > And shouldn't
> >
> >   assert (a, b), bad_msg
> >
> > trigger the message too ?
>
> nop. That's definitly intended, so we should raise any warning here.

in fact there are to cases :

1. assert (a, b)

  here we probably wanted 

  assert a, b # assert a or get the message b

2. assert (a, b), msg

  here the tuple is always true hence the assert is useless in best case
  
  similar cases are:

  assert (a,), msg

  assert (a, b, c)

  assert () # always False ; will probably never occur, but who 
knows ? ...

-- 

Emile Anclin <emile.anc...@logilab.fr>
http://www.logilab.fr/   http://www.logilab.org/ 
Informatique scientifique & et gestion de connaissances
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to