[Python-bugs-list] [ python-Bugs-407626 ] Trailing white space after line continue

nobody nobody@sourceforge.net
Sat, 10 Mar 2001 19:24:32 -0800


Bugs #407626, was updated on 2001-03-10 19:03
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407626&group_id=5470

Category: Parser/Compiler
Group: Not a Bug
Status: Closed
Priority: 5
Submitted By: Jeff Davis
Assigned to: Fred L. Drake, Jr.
Summary: Trailing white space after line continue

Initial Comment:
Trailing white space after a line continue character
(\) causes an "invalid token" error when parsing.

The trailing white space can be either tabs or spaces.

Tested against Python 2.0 and 2.1b1; error occurs in
both.

Request resolution: parser should ignore trailing white
space after line continue character

Sample code:

# ok -no trailing white space past line continue char
print	'case 1a' + \
	'case 1b'

# invalid token error - one space after line continue
char
print	'case 2a' + \ 
	'case 2b'

# invalid token error - one tab after line continue
char
print	'case 3a' + \	
	'case 3b'


----------------------------------------------------------------------

Comment By: Jeff Davis
Date: 2001-03-10 19:24

Message:
Logged In: YES 
user_id=170745

Ok, I see your reasoning.  It's just annoying because while 
editing I sometimes leave trailing white space after the 
line continue, then it breaks my flow when I get an error 
and have to go back and delete a few spaces or tabs that 
don't really matter.

I'll dig through the source and see if I can change it to 
ignore trailing white space after the line continue char to 
the end of line.  I can't imagine that *not* having it 
raise an error on trailing whitespace would cause problems 
for anyone, and it would help me out.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr.
Date: 2001-03-10 19:10

Message:
Logged In: YES 
user_id=3066

Python 1.5.2 also exhibits this behavior, and I'm fairly certain all previous versions did as well.  It's not at all clear this is a bug.  Typically, languages which use a line continuation character don't allow anything between the continuation character and the end of the physical line (in some, it's actually just an "escape" that causes the newline to be treated as any other whitespace character, as in the Unix shells).

I'm marking this "Not a bug" since there is no change in behavior or other reason to consider this an error.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407626&group_id=5470