Working around a lack of 'goto' in python

Jeff Epler jepler at unpythonic.net
Tue Mar 9 09:29:25 EST 2004


On Mon, Mar 08, 2004 at 11:39:50PM -0800, Roger Binns wrote:
> Jeff Epler wrote:
> > [Mr. Binns helpfully deleted the attribution, so I didn't even realize
> > right away he was replying to my post]
> 
> I was posting in the newsgroup where everything is well threaded.
> Apologies if you feel slighted.

Maybe I'm out of step, but I thought it was standard practice on Usenet
to name the person whose text is quoted.  The program I'm using displays
threads properly, but already-read messages are not shown in the index,
meaning that I don't always see the message being replied to.

> I think some of that could be alleviated through the use of 'else'
> with 'for/while' although it looks like I need the opposite of its
> semantics (a 'not else').  Quite frankly the existence of 'else' 
> in this context as a language feature baffles me and I don't use it.

The same goes for me.  I can never remember when the "else" clause will
execute, and for that reason I'm very unlikely to use it.

> 
> > I have seen one call
> > for [g(x) for x in l while f(x)].  
> 
> I didn't even know you could do that (the while).

I wasn't clear.  You *can't* use "while" in listcomps, and I've only seen
it requested once.

Jeff




More information about the Python-list mailing list