Message252297
The plain Python shell does respond to lines with only a comment and/or horizontal space with a continuation prompt. It only treats completely blank lines without any horizontal space specially:
>>>
... # Indented blank line above; completely blank line below:
...
>>>
Meador: The documentation already says what you proposed: “NL tokens are generated when a logical line of code is continued over multiple physical lines” <https://docs.python.org/dev/library/tokenize.html#tokenize.NL>.
Thomas: It sounds like you actually want to differentiate newlines inside bracketed expressions from newlines outside of statements. I think this would require a new feature.
Also, I noticed that an escaped continued newline doesn’t seem to generate any token at all. Not sure if this is a bug or intended, but it does seem inconsistent with the other uses of the NL token.
$ ./python -btWall -m tokenize
1 + \
1,0-1,1: NUMBER '1'
1,2-1,3: OP '+'
1
2,0-2,1: NUMBER '1'
2,1-2,2: NEWLINE '\n'
3,0-3,0: ENDMARKER '' |
|
Date |
User |
Action |
Args |
2015-10-05 02:10:32 | martin.panter | set | recipients:
+ martin.panter, meador.inge, takluyver |
2015-10-05 02:10:31 | martin.panter | set | messageid: <1444011031.92.0.750774995283.issue17061@psf.upfronthosting.co.za> |
2015-10-05 02:10:31 | martin.panter | link | issue17061 messages |
2015-10-05 02:10:31 | martin.panter | create | |
|