A simple single line, triple-quoted comment is giving syntax error. Why?

Thomas 'PointedEars' Lahn PointedEars at web.de
Sat Mar 21 23:49:10 EDT 2015


Chris Angelico wrote:

> On Sun, Mar 22, 2015 at 2:14 PM, Thomas 'PointedEars' Lahn
> <PointedEars at web.de> wrote:
>> Denis McMahon wrote:
>>> However, you can't have multiple expressions on a line without some sort
>>> of operand or separator between them.
>> String concatenation is implicit in Python, but only with string
>> *literals*:
> 
> Which aren't expressions.

IBTD:

,-<https://docs.python.org/3/reference/grammar.html>
| 
| […]
| expr: xor_expr ('|' xor_expr)*
| xor_expr: and_expr ('^' and_expr)*
| and_expr: shift_expr ('&' shift_expr)*
| shift_expr: arith_expr (('<<'|'>>') arith_expr)*
| arith_expr: term (('+'|'-') term)*
| term: factor (('*'|'/'|'%'|'//') factor)*
| factor: ('+'|'-'|'~') factor | power
| power: atom trailer* ['**' factor]
| atom: ('(' [yield_expr|testlist_comp] ')' |
|        '[' [testlist_comp] ']' |
|        '{' [dictorsetmaker] '}' |
|        NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False')

> Implicit concatenation is part of the syntax, not part of the expression 
> evaluator.

Reads like nonsense to me.
 
-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.



More information about the Python-list mailing list