PEP 255: Simple Generators

Neil Schemenauer nas at python.ca
Tue Jun 19 13:56:35 EDT 2001


Rainer Deyke wrote:
> def f():
>   return
>   yield 'Never reached.'
> 
> 
> Is this function a generator?  Yes, but only if nobody removes the seemingly
> redundant 'yield' statement.

    def f():
        return x
        x = 1

Is "x" a local variable?  Most of your arguments apply to local
variables as well.

  Neil




More information about the Python-list mailing list