checking if a list is empty

Ethan Furman ethan at stoneleaf.us
Thu May 12 10:02:37 EDT 2011


Chris Angelico wrote:
> 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).

Um -- you contradicted Ian, then contradicted yourself -- according to 
your scenario your shopping list is *not* empty when you go to the store 
(otherwise known as "going shopping" ;).

~Ethan~



More information about the Python-list mailing list