[Python-3000] PEP-3125 -- remove backslash continuation
jseutter at gmail.com
Thu May 3 19:17:27 CEST 2007
On 5/2/07, Andrew Koenig <ark at acm.org> wrote:
> Looking at PEP-3125, I see that one of the rejected alternatives is to
> any unfinished expression to indicate a line continuation.
> I would like to suggest a modification to that alternative that has worked
> successfully in another programming language, namely Stu Feldman's
> EFL. EFL
> is a language intended for numerical programming; it compiles into Fortran
> with the interesting property that the resulting Fortran code is intended
> be human-readable and maintainable by people who do not happen to have
> access to the EFL compiler.
> Anyway, the (only) continuation rule in EFL is that if the last token in a
> line is one that lexically cannot be the last token in a statement, then
> next line is considered a continuation of the current line.
> Python currently has a rule that if parentheses are unbalanced, a newline
> does not end the statement. If we were to translate the EFL rule to
> it would be something like this:
> The whitespace that follows an operator or open bracket or
> can include newline characters.
> Note that if this suggestion were implemented, it would presumably be at a
> very low lexical level--even before the decision is made to turn a newline
> followed by spaces into an INDENT or DEDENT token. I think that this
> property solves the difficulty-of-parsing problem. Indeed, I think that
> this suggestion would be easier to implement than the current
> unbalanced-parentheses rule.
Would this change alter where errors are reported by the parser? Is my
x = x + # Oops.
... some other code ...
going to have an error reported 15 lines below where the actual typo was
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-3000