from __future__ import generators

Martin von Loewis loewis at
Sun Aug 12 13:02:53 CEST 2001

Guido van Rossum <guido at> writes:

> 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.

Of course, in Python, there doesn't have to be a defining occurrence
of every identifier used:

def foo(a):
    print a

globals()['yield'] = foo

def bar():
    yield (1)


would break silently if yield became a keyword without a future import.


More information about the Python-list mailing list