[Python-Dev] Relative import
Guido van Rossum
guido at python.org
Tue Dec 16 13:43:46 EST 2003
> On a related and minor note, can we please expand the grammar to allow
> from...import statements to continue to the next line after a trailing
> comma? For those of us with large, complex, and componentized projects, it
> would be very nice. e.g.:
>
> from OPAL.Modules.Financial.Reports.COGS import generate, webOptions,
> normalize, row_ops,
> summary
>
> instead of:
>
> from OPAL.Modules.Financial.Reports.COGS import generate, webOptions, \
> normalize, row_ops, \
> summary
>
>
> This has been a minor nit that bothers just under the threshold of fixing it
> myself. ;)
I guess this could be implemented by allowing [NEWLINE] after the
comma in the grammar.
But I'm -0 on this change; I fear that someone accidentally adding a
trailing comma (or leaving it in after some rearrangements) will be
very puzzled at the syntax error that comes somewhere in the middle of
the next statement:
from foo import bar,
bufsize = 12
^syntax error
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list