SyntaxError not honoured in list comprehension?

jmfauth wxjmfauth at gmail.com
Sun Jul 4 04:31:41 EDT 2010


Python all versions.

It's not a bug, but I'm suprised the following does
not raise a SyntaxError (missing space between
'9' and 'for').

>>> [9for c in 'abc']
[9, 9, 9]
>>>

Side effect: If this behaviour is considered as correct,
it makes a correct Python code styling (IDLE, editors, ...)
practically impossible to realise.



More information about the Python-list mailing list