[issue31253] Python fails to parse commented out code

2017-08-22 Thread Andrew Wall

Andrew Wall added the comment:

My lazy way of programming is to piece together lines of code, going round and 
round commenting and uncommenting sections until I get something that works.

My new lazy way of commenting out larger chunks of code will be:

r'''
... several lines of code here ...
'''

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31253] Python fails to parse commented out code

2017-08-22 Thread Vedran Čačić

Vedran Čačić added the comment:

That's because it is not commented code, it is a multiline string literal. And 
it is not raw, so \Un... is just an error, since n is not a valid hexadecimal 
digit. In the first code, \Un... is inside a raw string so it is read literally.

There is nothing to fix here. If you really want to continue confusing string 
literals and comments, you'll have to use r'''...''' to be a bit more general 
for this case.

--
nosy: +veky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31253] Python fails to parse commented out code

2017-08-22 Thread Andrew Wall

New submission from Andrew Wall:

Python can parse and run this code:

log = list(r'..\Unknown\*.txt')


but not this:

'''
log = list(r'..\Unknown\*.txt')
'''

--
components: Interpreter Core
messages: 300670
nosy: quamrana
priority: normal
severity: normal
status: open
title: Python fails to parse commented out code
type: compile error
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com