checking if a list is empty

Chris Angelico rosuav at gmail.com
Wed May 11 23:51:12 EDT 2011


On Thu, May 12, 2011 at 7:02 AM, Ian <hobson42 at gmail.com> wrote:
> In the "real world"  lists of zero items do not exist.
> You don't go shopping with a shopping list of zero items.

Actually, yes you do. You maintain your shopping list between trips;
whenever you need something, you put it on the list immediately. Then
when you go shopping, you just take the list with you (if you're
lucky, you don't need to move or copy it at all, you just get another
reference to it). Once you're done, you empty the list - you now have
a shopping list with zero items (until you get home and realize you
forgot something).

Chris Angelico



More information about the Python-list mailing list