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. As I have learnt, 0 and False both hash to the same value (same for 1 and True). >>> b = {0:'xyz', False:'abc'} >>> b {0: 'abc'} # Am I the only one who thinks this is weird? This obviously stems from the fact that 0 == False but 0 is not False etc. etc. That doesn't help my case where I need to distinguish between the two The same issue applies in a list: Suppose I do: >>> a = [0, 1, True, False] >>> a.index(False) 0 Wha??? Help. -- http://mail.python.org/mailman/listinfo/python-list