from __future__ import generators

Paul Svensson paul at
Sun Aug 12 21:33:16 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.

Not if you work hard enough at it...

def broken(x): return x
globals()['yield'] = broken
def broken(x): yield(17)
print broken(((((((((((((((((((((((((((((())))))))))))))))))))))))))))))

Works as intended, no warnings in 2.1


More information about the Python-list mailing list