Python end of file marker similar to perl's __END__

Cameron Laird claird at lairds.us
Wed Aug 1 11:33:02 EDT 2007


In article <slrnfb17m5.224.horpner at FIAD06.norwich.edu>,
Neil Cerutti  <horpner at yahoo.com> wrote:
>On 2007-08-01, beginner <zyzhu2000 at gmail.com> wrote:
>> Thanks everyone for responding. It doesn't look like python has
>> it. I would definitely miss it. As Steve said, the nice thing
>> about __END__ is that things below __END__ do not have to have
>> legit syntax. That let me focus on the lines of code I am
>> debugging and do not have to worry about some bad syntax down
>> the line. This feature is especially handy if I am, saying,
>> replacing modoules or changing data structures.
>
>A C-like trick might be helpful while refactoring:
>
><working code>
>if False:
>   <non-working code>
>
>You have to indent all the non-working code by one level, but
>with a good editor that's a snap.
>
>Python will still parse the following lines (it must be valid
>Python syntax), but the resulting parse tree won't be executed.
			.
			.
			.
I want to re-emphasize the "triple-quote it" tip mentioned
earlier in this thread.  I think the original questioner
will find this quite satisfying, if I understand his situ-
ation at all.

*I* certainly have source code with embedded "junk" 
commented out as multi-line strings.



More information about the Python-list mailing list