urhfpg
Last Updated: February 25, 2016
·
447
· lyndsysimon

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']