Martin Panter added the comment:

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      ''

----------
nosy: +martin.panter
type: behavior -> enhancement
versions: +Python 3.6 -Python 2.6, Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17061>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to