[Python-ideas] allow line break at operators

Guido van Rossum guido at python.org
Sun Sep 18 16:54:35 CEST 2011

On Sun, Sep 18, 2011 at 4:38 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> No, my question is how can I introspect the Python runtime state to
> compare two statements:
>    foo = "spam" "eggs"
>    bar = "spam" + "eggs"
> and show that the *result as produced by the parser* is that the first
> statement has a single string literal on the right hand side, while the
> second statement has a concatenation expression between two string
> literals.
> In other words: once I've come to a hypothesis from my reading of the
> grammar, how can I *verify* that against the actual running Python
> language parser?

I'm confused why anybody would care about the answer. Is this just to
settle an argument where someone claimed that "foo" "bar" was two
strings whereas someone else claimed that it was one? You can't answer
that by looking at the AST -- you have to think about what the proper
definition of string should be. Personally I think of it as two string
literals. Maybe that will stop this thread?

--Guido van Rossum (python.org/~guido)

More information about the Python-ideas mailing list