question about True values

Terry Reedy tjreedy at udel.edu
Thu Oct 26 03:29:57 CEST 2006


"Steve Holden" <steve at holdenweb.com> wrote in message 
news:ehoqhe$6iq$3 at sea.gmane.org...

>> 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?

more that one:

0L
decimal.Decimal(0) # is decimal.Decimal('0'), also
u''
array.array('c') # or any other typecode, I suspect, without initializer

Terry Jan Reedy






More information about the Python-list mailing list