if the else short form

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Oct 6 10:31:48 CEST 2010


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.



More information about the Python-list mailing list