Skip to content

Instantly share code, notes, and snippets.

@klang
Created September 9, 2014 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klang/0ce55aec4b64d84e51b1 to your computer and use it in GitHub Desktop.
Save klang/0ce55aec4b64d84e51b1 to your computer and use it in GitHub Desktop.
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