[Python-ideas] allow line break at operators
Ben Finney
ben+python at benfinney.id.au
Sun Sep 18 13:38:33 CEST 2011
More information about the Python-ideas mailing list
Sun Sep 18 13:38:33 CEST 2011
- Previous message: [Python-ideas] allow line break at operators
- Next message: [Python-ideas] allow line break at operators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Georg Brandl <g.brandl at gmx.net> writes: > Am 18.09.2011 12:22, schrieb Ben Finney: > > Arnaud Delobelle <arnodel at gmail.com> > > writes: > > > >> On 4 September 2011 23:39, Ben Finney <ben+python at benfinney.id.au> wrote: > >> > Ben Finney <ben+python at benfinney.id.au> writes: > >> > > >> >> How many string literals do you count in the following > >> >> statement? I count one: > >> >> > >> >> raise HoustonWeHaveAProblemError( > >> >> "Lorem ipsum dolor sit amet," > >> >> " consectetur adipiscing elit.") > >> > >> The code object says that there's one string constant in the > >> compiled function. It says nothing (and knows nothing) about the > >> number of string literals that made up this string. > > > > Hmm. So how should I be looking to answer the question? My AST-fu is > > weak. > > It is sufficient to look into Grammar/Grammar: 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? -- \ “Broken promises don't upset me. I just think, why did they | `\ believe me?” —Jack Handey | _o__) | Ben Finney
- Previous message: [Python-ideas] allow line break at operators
- Next message: [Python-ideas] allow line break at operators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list