Subtle bug: missing commas in iterables
One of Python's features that I am not fond of is the implicit concatenation syntax. Two strings places side by side with no separator are automatically joined at runtime:
x = 'foo' 'bar'
print(x)
>>>'foobar'
This makes for some potentially subtle errors when creating lists and tuples:
x = [
'a',
'b',
'c'
'd',
'e',
]
print(repr(x))
>>>['a', 'b', 'cd', 'e']
Written by Lyndsy Simon
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Related Tags
#python
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#