Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:module': 0.04; 'perl,': 0.05; 'retrieved': 0.05; 'chooses': 0.07; 'caller': 0.09; 'pm,': 0.10; 'this:': 0.10; 'wrote:': 0.14; 'anyhow,': 0.16; 'evaluates': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "function's": 0.16; 'guessing': 0.16; 'handle,': 0.16; 'handle:': 0.16; 'ignored,': 0.16; 'quite.': 0.16; 'sure,': 0.16; 'uncommon': 0.16; 'yell': 0.16; 'things.': 0.16; 'language,': 0.17; 'language': 0.18; 'perl': 0.19; 'specifies': 0.19; 'header:In-Reply-To:1': 0.21; 'file,': 0.22; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'function': 0.25; 'message- id:@mail.gmail.com': 0.28; 'sat,': 0.29; 'ignored.': 0.29; 'colon': 0.30; 'config': 0.30; 'false.': 0.30; 'done': 0.32; 'cases': 0.32; 'steven': 0.32; 'does': 0.33; 'to:addr:python- list': 0.33; 'comment': 0.33; "isn't": 0.33; 'things': 0.33; "i've": 0.33; 'source': 0.34; 'file': 0.34; 'there': 0.35; "d'aprano": 0.35; 'visible': 0.35; 'using': 0.35; 'program,': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'keywords': 0.37; 'put': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'comments': 0.39; 'sometimes': 0.39; 'received:209': 0.39; 'abuse': 0.39; 'rest': 0.39; 'to:addr:python.org': 0.39; 'special': 0.66; 'batch': 0.68; 'beast': 0.84; 'labels': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=7S3oOw9wZIMD6Gp+xJlruyGLS7GdH2KQttaPvCSaNAA=; b=HWgghtZ2hCA6b6d6oekr9bFd6EUr5A9HFRrwdDhslTszhMy6vzwSQN+TBWupxtMd25 IPZSBXrn89ynS59Blktr5zBUVNklMIRJj6ObQ7nQZqMo6yhXPsuZws8gdN994xqFZZnd FCP356e1em9nLH6a9H2OHZ34FOSS7inz0Rskw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=kspwfbmcdanmNS1+zLt/jzXDNcvHgdTniQaaStowSwiSy/Kjf3TSToJoAnDjs8HicQ fXqJCdBIa4ECB9+AxUhmgMhUawM+imph0Qr9mFZGd5mKIB0VGRd6JUclnZW6lO2hNGAU /fIasYn7E464rP5TwNS+JaLxl2IoqNiSS8TCU= MIME-Version: 1.0 In-Reply-To: <4dfc2e42$0$30002$c3e8da3$5496439d@news.astraweb.com> References: <4dfaed89$0$30002$c3e8da3$5496439d@news.astraweb.com> <4dfc2084$0$30002$c3e8da3$5496439d@news.astraweb.com> <4dfc2e42$0$30002$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 18 Jun 2011 15:06:47 +1000 Subject: Re: break in a module From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308373611 news.xs4all.nl 49176 [::ffff:82.94.164.166]:36773 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7887 On Sat, Jun 18, 2011 at 2:49 PM, Steven D'Aprano wrote: > 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: Sure, but if you don't use that handle, it comes to the same thing. It's like a function's return value when you just want its side effects, or using re.match and ignoring all but whether it evaluates as True or False. In REXX, you can access any part of the source file using the sourceline() function - sometimes I've done things like this: /* Usage: scriptname [arg] [arg] [arg] arg: specifies the number of times to yell Argh arg: specifies the type of black beast to kill you arg: chooses an Abstract Resource Group Use this only in cases of blargh. */ . . . . usage: do i=2 to sourceline() until sourceline(i)="*/"; say sourceline(i); end Does this mean that the comment isn't ignored? Nope. It's ignored, but it can be retrieved through in-language means. Anyhow, it's not uncommon to abuse language features to do different things. I've heard that it's faster in MS-DOS Batch to put comments with a leading colon (making them labels for goto) than to use the REM (remark) command... ChrisA