This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter, meador.inge, takluyver
Date 2015-10-05.02:10:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1444011031.92.0.750774995283.issue17061@psf.upfronthosting.co.za>
In-reply-to
Content
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      ''
History
Date User Action Args
2015-10-05 02:10:32martin.pantersetrecipients: + martin.panter, meador.inge, takluyver
2015-10-05 02:10:31martin.pantersetmessageid: <1444011031.92.0.750774995283.issue17061@psf.upfronthosting.co.za>
2015-10-05 02:10:31martin.panterlinkissue17061 messages
2015-10-05 02:10:31martin.pantercreate