Dec-07-2019, 07:56 PM
(This post was last modified: Dec-07-2019, 07:57 PM by ichabod801.)
True and False are actually subclasses of integers, with True equal to 1 and False equal to 0. You can test this by adding them to normal integers. So when Python gets to 'True: False', it sets the value of 1 to False, overriding the previous value of 'apple'.
To be more specific, if hash(x) == hash(y) and x == y, then dictionaries will treat x and y as the same key. That's what is going on here.
To be more specific, if hash(x) == hash(y) and x == y, then dictionaries will treat x and y as the same key. That's what is going on here.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures