[Python-ideas] x=(yield from) confusion [was:Yet another alternative name for yield-from]

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Apr 12 01:35:30 CEST 2009


Nick Coghlan wrote:
> The main change I
> would like from the original version of the PEP is for caching the bound
> methods to be explicitly disallowed in order to match the behaviour of
> normal for loops.

But if I let the expansion serve as a literal specification,
it won't match the behaviour of for-loops either, because
although it doesn't cache methods, PyIter_Next isn't
exactly the same as looking up next() on the instance
either.

I definitely don't want to preclude the implementation
from using PyIter_Next, as that would be a major
performance hit in the most common case.

I also don't want to preclude caching a send() method,
because in the absence of a __send__ typeslot it's the
only way we have of improving performance.

I don't care much about throw() or close(), because
they will rarely be called anyway. But by the same
token, little would be gained by a wrapper using fancy
tricks to redirect them.

-- 
Greg



More information about the Python-ideas mailing list