> Are they widespread? I haven't noticed, yet.
> 
> I prefer to write it explicitly:
> 
> if len(lst) > 0:

I prefer to test explicitly for the truth value of the
list. I don't want to test whether the length of the list
is greater than 0 (in fact, I don't care about the length
property of the list at all) - I want to know whether the
list is empty (or not empty). The Python syntax for this
test is

if lst:
  # not empty

or

if not list:
  #empty

The view "let me test for the precise value" leads to
formulations like

if foo is True:
   return True
else:
   return False

People should have more trust in boolean conversions.

Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to