[Python-Dev] Re: PEP 285: Adding a bool type

Mark McEahern marklists@mceahern.com
Wed, 3 Apr 2002 12:26:32 -0600


[Ka-Ping Yee]
> What about this:
>> >>> d = {}
> >>> d[0] = 'zero'
> >>> d[False] = 'false'
> >>> len(d)
> 1 or 2?

This returns:
 1
Just curious: If you were using True and False as keys to a dictionary,
would you ever expect len(d) to return something > 2?
// mark

AltStyle によって変換されたページ (->オリジナル) /