dict1 < dict2 <=> len(dict1) <= len(dict2) ?

Delaney, Timothy tdelaney at avaya.com
Mon Oct 21 04:18:43 CEST 2002


> From: Tim Peters [mailto:tim.one at comcast.net]
> 
> [Tim]
> > 2. Comparing a dict against an empty dict, as in
> >
> >      while dict > {}:
> 
> [Delaney, Timothy]
> > Do people actually do that Tim? That's brain dead ...
> >
> >     while not dict:
> 
> No, *that's* brain dead <wink>.  What a normal person does is
> 
>     while dict:
> 
> Perhaps those who get burned by writing "not dict" instead 
> feel that "dict >
> {}" is clearer.  I haven't seen it often in any case.

You just had me laugh out loud at my own idiocy :)

Tim Delaney




More information about the Python-list mailing list