from __future__ import generators
Paul Svensson
paul at svensson.org
Sun Aug 12 15:33:16 EDT 2001
Guido van Rossum <guido at python.org> 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
/Paul
More information about the Python-list
mailing list