Trailing commas in python
This has tripped me off way more than I would like. For those of you who don't know adding a comma makes a variable into tuple (Yes its not the C bracket)
foo = 1,
print(type(foo))
It prints:
<class 'tuple'>
rahem027.hashnode.dev1 min read
Sean Charles
shizzleishappenin
It's always good to know about the different notation types: infix, postfix and prefix. Then, it's good to know how and when your language of choice decides to enforce them! Extending your example in 3.6 at the REPL confuses me more!
>>> foo = 1, >>> print(type(foo)) <class 'tuple'> >>> print(type(1,)) <class 'int'>