[Python-Dev] Merging PEP 310 and PEP 340-redux?

Shane Holloway (IEEE) shane.holloway at ieee.org
Fri May 13 22:51:58 CEST 2005


+1 PEP 340 redux (although I marginally prefer the "with" keyword)

Guido van Rossum wrote:
> So then the all-important question I want to pose is: do we like the
> idea of using a (degenerate, decorated) generator as a "template" for
> the do-statement enough to accept the slightly increased complexity?
> The added complexity is caused by the need to separate VAR from EXPR
> so that a generator can be used. I personally like this separation; I
> actually like that the "anonymous block controller" is logically
> separate from the variable bound by the construct. From Greg Ewing's
> response to the proposal to endow file objects with __enter__ and
> __exit__ methods, I believe he thinks so too.

+1 to support template generators.  I think it allows for more 
flexibility on the class implementations as well, even if most of them 
return self.


> - Today I like the 'do' keyword better; 'with' might confuse folks
> coming from Pascal or VB

As a former pascal/delphi guy, I wasn't really confused.  ;)

+1 with
+0 do

> - I have a more elaborate proposal for __exit__'s arguments. Let the
> translation be as follows:

+1 -- as long as I can get information about how the block exited, I'm 
happy.

> If we adopt PEP 340 redux, it's up to the decorator for degenerate
> generators to decide how to pass this information into the generator;
> if we adopt PEP 342 ("continue EXPR") at the same time, we can let the
> yield-expression return a 4-tuple (oke, t, v, tb). Most templates can
> ignore this information (so they can just use a yield-statement).

+1 makes sense to me...


More information about the Python-Dev mailing list