[issue20240] Whitespace ignored in relative imports: from.package import something is valid syntax

Eric V. Smith report at bugs.python.org
Mon Jan 13 14:34:24 CET 2014


Eric V. Smith added the comment:

This is no different from other places in python where white space is optional. As long as the parser can tell the end of a token, there need not be white space before the next token.

For example:
>>> 1+2
3
>>> 1 + 2
3

However, if the parser cannot tell the end of a token, white space is required:
>>> 1.__add__
  File "<stdin>", line 1
    1.__add__
            ^
SyntaxError: invalid syntax
>>> 1 .__add__
<method-wrapper '__add__' of int object at 0x1300c68>

We're not likely to add "required white space" after the "from" token.

[I realize that in a "whitespace required" language, this is a slightly odd statement!]

----------
nosy: +eric.smith
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20240>
_______________________________________


More information about the Python-bugs-list mailing list