[Python-Dev] Re: anonymous blocks

Brett C. bac at OCF.Berkeley.EDU
Thu Apr 28 02:52:13 CEST 2005


Guido van Rossum wrote:
[SNIP]
>>It's interesting that there is such similarity between 'for' and
>>'block'.  Why is it that block does not call iter() on EXPR1?  I
>>guess that fact that 'break' and 'return' work differently is a more
>>significant difference.
> 
> 
> Well, perhaps block *should* call iter()? I'd like to hear votes about
> this. In most cases that would make a block-statement entirely
> equivalent to a for-loop, the exception being only when there's an
> exception or when breaking out of an iterator with resource
> management.
> 

I am -0 on changing it to call iter().  I do like the distinction from a 'for'
loop and leaving an emphasis for template blocks (or blocks, or whatever hip
term you crazy kids are using for these things at the moment) to use
generators.  As I said before, I am viewing these blocks as a construct for
external control of generators, not as a snazzy 'for' loop.

-Brett


More information about the Python-Dev mailing list