question about True values

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Oct 25 20:50:01 EDT 2006


Steve Holden <steve at holdenweb.com> writes:

> skip at pobox.com wrote:
> > s is not equal to the boolean object True, but it also doesn't
> > evaluate to the string class's "nil" value.  Each of the builtin
> > types has such an "empty" or "nil" value:
> > 
> >     string              ""
> >     list                []
> >     tuple               ()
> >     dict                {}
> >     int                 0
> >     float               0.0
> >     complex             0j
> >     set                 set()
> > 
> > Any other value besides the above will compare as "not false".
>
> And today's question for the novices is: which Python type did Skip
> miss from the above list?

       bool             False

-- 
 \     "[The RIAA] have the patience to keep stomping. They're playing |
  `\      whack-a-mole with an infinite supply of tokens."  -- kennon, |
_o__)                                             http://kuro5hin.org/ |
Ben Finney




More information about the Python-list mailing list