checking if a list is empty

Hans Georg Schaathun hg at schaathun.net
Wed May 11 10:05:45 EDT 2011


On 11 May 2011 12:14:46 GMT, Steven D'Aprano
  <steve+comp.lang.python at pearwood.info> wrote:
:  Not knowing that you can write "if x" instead of "if x == []" is like not 
:  knowing that you can write 
: 
:      elif condition
: 
:  instead of 
: 
:      else:
:          if condition

My concern was with the reader and not the writer.

What could elif mean other than else: if?

if x could, for instance,  mean "if x is defined".


-- 
:-- Hans Georg



More information about the Python-list mailing list