You have a strange definition of "work":
>>> eval("for i in range(5):\n print 'hello'") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1 for i in range(5): ^ SyntaxError: invalid syntax >>>
I'm not sure why you are using eval - I suspect you mean exec . Expressions and statements are essentially different objects in Python - eval processes only expressions (a simple expression is also an expression, so exec can deal with it, as well as with other operators).
Turning to exec and thinking of the situation as an explicit Python committer, I think this is a minor wrong design: just like (redundant and useless) spaces, tabs and form feeds before NEWLINE is accepted and ignored, so it should (like redundant and useless ) carriage return. I apologize: I think we never thought that someone might want to return the carriage there, but then it makes no sense to have, for example, forms, and we accept this ... therefore I see no reason to reject carriage returns ( or another Unicode space without ANSI), or now that in Python 3 we accept arbitrary Unicode characters other than ANSI in identifiers).
If you do not care, please open a problem with the tracker on the Python problem and (prohibit unforeseen opposition by other participants). I think I can fix it with Python 3.2 (which should be in 12-18 months) that the assessment is [informed assumption] and not a promise; -).
source share