break in a module

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Jun 18 00:49:06 EDT 2011


On Sat, 18 Jun 2011 14:31:51 +1000, Chris Angelico wrote:

> On Sat, Jun 18, 2011 at 1:50 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> I don't think the use-case for this is convincing enough to need it,
>> but it's an interesting concept. I once played around with a
>> mini-language for config files that included a "STOP" command, so that:
>>
>> key = value
>> STOP
>> everything under here is ignored
>>
>>
> Isn't that how Perl's __data__ keyword works? (Long time since I've used
> it, it mightn't be quite __data__.)

Not quite. In my config language, "ignored" means ignored. There was no 
way of accessing the rest of the file, short of guessing the file name, 
opening it and reading it as text.

In Perl, the __END__ and __DATA__ keywords mark the end of the Perl 
program, and leave the rest of the document visible to the caller via a 
special file handle:

http://www.perl-programming.info/difference-btw-__end__-and-__data__


You know, I actually kinda like that...


-- 
Steven



More information about the Python-list mailing list