Python end of file marker similar to perl's __END__

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


beginner <zyzhu2000 at gmail.com> writes:

> In perl, I can write __END__ in a file and the perl interpreter will
> ignore everything below that line.

IIRC, this Perl feature is specifically intended to work with its
feature of reading data from the same file, as all the lines following
that marker.

> This is very handy when testing my program.

If my understanding above is correct, then your use of it is a happy
repurposing of the feature, and not an intended use.

> Does python have something similar?

Since it doesn't have the behaviour that inspired that feature in
Perl, I doubt it.

-- 
 \                          "Everything is futile."  -- Marvin of Borg |
  `\                                                                   |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list