[Python-ideas] Revised**12 PEP on Yield-From

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Apr 20 03:22:35 CEST 2009


Jacob Holm wrote:

> First a minor nit.  There is no need to use getattr if the name is 
> constant and you are going to catch AttributeError anyway.  Just use 
> _i.close and _i.throw.

Quite right. I can't have been thinking very straight
when I did that!

> We should probably add
> 
>   _x = sys.exc_info()
> 
> as the first line in the "except BaseException as _e" block, and change
> 
>   _y = _m(*sys.exc_info())
> 
> to:
> 
>   _y = _m(*_x)

I'm not sure if this is really necessary, since function
calls save/restore the exception being handled, if I
understand correctly. But I suppose it can't hurt to
clarify this.

> FWIW I still consider an expansion using functools.partial to be more 
> readable

That's a matter of opinion -- I find it harder to follow
because it separates the logic for deciding which method
to call from the place where it's called. Also I would
rather express the expansion in terms of core language
features as far as possible rather than relying on
something imported from a library.

> Anyway, it looks to me like we are almost done.  What are the chances of 
> getting this into 3.1 and 2.7?

You'd have to ask Guido.

-- 
Greg



More information about the Python-ideas mailing list