Re: compile() and comments

2008-10-14 Thread Terry Reedy
Steve Holden wrote: Ed Leafe wrote: On Oct 13, 2008, at 8:35 AM, Fuzzyman wrote: It is certainly an odd restriction, but the docs for compile [1] do explicitly state that the input must be newline terminated. Understood; what I found odd was that if the last non-newline-terminated statem

Re: compile() and comments

2008-10-14 Thread Steve Holden
Ed Leafe wrote: > On Oct 13, 2008, at 8:35 AM, Fuzzyman wrote: > >> It is certainly an odd restriction, but the docs for compile [1] do >> explicitly state that the input must be newline terminated. > > > Understood; what I found odd was that if the last > non-newline-terminated statement wa

Re: compile() and comments

2008-10-13 Thread Ed Leafe
On Oct 13, 2008, at 7:20 PM, Terry Reedy wrote: I would prefer more consistent behavior. I have opened a separate doc issue that includes the documentation of this issue. http://bugs.python.org/issue4118 Again, it was not a show-stopper by any means; more of a curiosity. Thanks for verif

Re: compile() and comments

2008-10-13 Thread Terry Reedy
Ed Leafe wrote: On Oct 13, 2008, at 8:35 AM, Fuzzyman wrote: It is certainly an odd restriction, but the docs for compile [1] do explicitly state that the input must be newline terminated. Understood; what I found odd was that if the last non-newline-terminated statement was *not* a com

Re: compile() and comments

2008-10-13 Thread Ed Leafe
On Oct 13, 2008, at 8:35 AM, Fuzzyman wrote: It is certainly an odd restriction, but the docs for compile [1] do explicitly state that the input must be newline terminated. Understood; what I found odd was that if the last non-newline- terminated statement was *not* a comment, no error was

Re: compile() and comments

2008-10-13 Thread Fuzzyman
Hello Ed, It is certainly an odd restriction, but the docs for compile [1] do explicitly state that the input must be newline terminated. When compiling multi-line statements, two caveats apply: line endings must be represented by a single newline character ('\n'), and the input must be termi

compile() and comments

2008-10-13 Thread Ed Leafe
I've noticed an odd behavior with compile() and code that does not contain a trailing newline: if the last line is a comment inside of any block, a syntax error is thrown, but if the last line is a non- comment Python statement, there is no error. Here's an example (using 2.5.1 on OS X) >