[Python-Dev] Re: Relative import
Fredrik Lundh
fredrik at pythonware.com
Tue Dec 16 14:36:36 EST 2003
Guido van Rossum wrote:
> > 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
you could require parentheses:
from OPAL.Modules.Financial.Reports.COGS import (
generate, webOptions, normalize, row_ops,
summary
)
(after all, from-import is a kind of assignment, and "a, b = c" is
the same thing as "(a, b) = c"...)
</F>
More information about the Python-Dev
mailing list