False and 0 in the same dictionary

Duncan Booth duncan.booth at invalid.invalid
Tue Nov 4 15:52:54 EST 2008


Prateek <surekap at gmail.com> wrote:

> I've been using Python for a while (4 years) so I feel like a moron
> writing this post because I think I should know the answer to this
> question:
> 
> How do I make a dictionary which has distinct key-value pairs for 0,
> False, 1 and True.

How about using (x, type(x)) as the key instead of just x?






More information about the Python-list mailing list