if the else short form

Antoon Pardon Antoon.Pardon at rece.vub.ac.be
Wed Oct 6 05:49:26 EDT 2010


On Wed, Oct 06, 2010 at 09:31:48PM +1300, Lawrence D'Oliveiro wrote:
> In message <mailman.1384.1286348190.29448.python-list at python.org>, Antoon 
> Pardon wrote:
> 
> > A lot of times someone comes with code like the following:
> > 
> >   if len(lst) != 0:
> >     ...
> > 
> > 
> > and than gets the advise to write it as follows:
> > 
> >   if lst:
> >     ...
> > 
> > Do you mean that this second piece of code is incorrectly written ...
> 
> Yes.

OK, but you do realise this is a minority opinion within the python
community?

-- 
Antoon Pardon



More information about the Python-list mailing list