Ed Leafe wrote: > On Oct 12, 2008, at 12:23 PM, Dabo Trac wrote: > >> Confirmed. WIll look into it. > > [moved to dabo-dev] > > This looks like a Python bug. Can someone else confirm this? Try the > following: > > txt = """def someFunc(): > print "Func called" > # Ending comment > """ > compcode = compile(txt, "", "exec") > > That should work without error. Now try: > > compstrip = compile(txt.strip(), "", "exec") > > That should throw an error. > > Seems that Python doesn't like the very last line of a file to be a > comment.
I vaguely think I remember this being documented somewhere as "by design". Plus historically it's a good idea for there to be a newline at the end of the file. Not defending the behavior, though. Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]
