Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python end of file marker similar to perl's __END__


  • From: bignose+hates-spam at benfinney.id.au (Ben Finney)
  • Subject: Python end of file marker similar to perl's __END__
  • Date: Wed, 01 Aug 2007 18:33:11 +1000

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