from __future__ import generators

Guido van Rossum guido at python.org
Sun Aug 12 03:48:50 CEST 2001


pinard at iro.umontreal.ca (François Pinard) writes:

> [Guido van Rossum]
> 
> > If enough people prefer to always have the 'yield' keyword enabled, we can
> > do that.  I thought that there would be a huge opposition against breaking
> > code this way, but maybe it's OK.  At least 'yield' is not a silent break.
> 
> My voice is surely not representative, but it is a voice nevertheless.
> When the direction is good, I prefer to see things moving forward, and
> would avoid `from __future__' here.  Yet, I also understand the concerns you
> have about not disturbing other Python users.  My opinion is that globally
> replacing `yield' by something else, using about any editor, is an easy
> challenge.  It could be advised somewhere in the transition documentation.

It's still open for debate -- the newsgroup doesn't seem to be
unanimous.

But note that future statements were intended in the first place to
avoid *silent* breakage -- where existing code suddenly means
something different.  This was the case (in some rare situations) with
nested scopes and is clearly the case with division.

Use of 'yield' as an identifier is not a silent breakage -- there has
to be at least one defining occurrence of yield when used as a
variable, function, module or class name, and that will always be a
syntax error.  This is why I proposed that, *if* there is enough
popular support, the future generators statement might be
unnecessary.  But it doesn't look likely.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list