Dictionary membership check failure
Steve Holden
steve at holdenweb.com
Wed Nov 5 15:43:14 EST 2008
Zac Burns wrote:
> Greetings,
>
> I have a dictionary that seems to be misbehaving on a membership
> check. This test code:
>
> 1: import types
> 2: assert myDict.__class__ is types.DictionaryType
[...]
For the record, it would be much simpler and more readable to say
assert type(myDict) is dict
not to mention it avoids the unnecessary import.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list