[Tutor] Testing for empty list

Wayne srilyk at gmail.com
Mon Oct 19 03:29:53 CEST 2009

Hi, I think I recall seeing this here, but I wanted to make sure I'm
Is the best way to test for an empty list just test for the truth value?

mylist = [1,2,3]

while mylist:
   print mylist.pop()


To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn’t. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091018/384a8376/attachment.htm>

More information about the Tutor mailing list