Here's a gotcha I once saw someone post involving dictionary keys:
This program:
#!/usr/bin/env python print {0: "o hai!", False: "kthxbai", 1: "foo", True: "bar"} print {False: "o hai!", 0: "kthxbai", True: "foo", 1: "bar"}
Yields this output:
{0: 'kthxbai', 1: 'bar'} {False: 'kthxbai', True: 'bar'}
It never bit me in any production code, but still, I thought it was interesting enough to share.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here's a gotcha I once saw someone post involving dictionary keys:
This program:
Yields this output:
It never bit me in any production code, but still, I thought it was interesting enough to share.