Python end of file marker similar to perl's __END__

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Aug 1 20:00:04 EDT 2007


beginner <zyzhu2000 at gmail.com> writes:

> 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.

I think the unaddressed question is: Why is there so much code in your
module with invalid syntax that this trick would be useful?

> 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.

I would strongly recommend you examine what part of your practice is
leading you to write so much code with invalid syntax, without
immediately testing and fixing it. Eliminate that part of the process
— possibly with test-driven development.

-- 
 \                "Holy unrefillable prescriptions, Batman!"  -- Robin |
  `\                                                                   |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list