Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python oddities
# array
>>> [1]
[1]
>>> [1,]
[1]
# hash
>>> {'a':1}
{'a': 1}
>>> {'a':1,}
{'a': 1}
# set (not idiomatic)
>>> {1}
set([1])
>>> {1,}
set([1])
# list
>>> (1)
1
# WHAT?!?
>>> (1,)
(1,)
# the ',' is the list constructor, not '(' as expected!
# why?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment