[Python-Dev] Re: anonymous blocks

Nick Coghlan ncoghlan at gmail.com
Thu Apr 28 00:00:40 CEST 2005

Brett C. wrote:
> And while the thought is in my head, I think block statements should be viewed
> less as a tweaked version of a 'for' loop and more as an extension to
> generators that happens to be very handy for resource management (while
> allowing iterators to come over and play on the new swing set as well).  I
> think if you take that view then the argument that they are too similar to
> 'for' loops loses some luster (although I doubt Nick is going to be buy this  =) .

I'm surprisingly close to agreeing with you, actually. I've worked out that it 
isn't the looping that I object to, it's the inability to get out of the loop 
without exhausting the entire iterator.

I need to think about some ideas involving iterator factories, then my 
objections may disappear.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list