PEP 318

Isaac To kkto at csis.hku.hk
Mon Mar 22 22:27:57 EST 2004


>>>>> "Stephen" == Stephen Horne <steve at ninereeds.fsnet.co.uk> writes:

    >> The syntax can be extended, i.e. "def foo() as generator" looks to me
    >> to be a lot more explicit than "def foo()" followed by having the
    >> compiler search the function body for a yield statement in order to
    >> decide if it's a generator.

    Stephen> Good point. Though to me, it isn't that it's a pain for the
    Stephen> compiler to search for the 'yield' - I don't care about the
    Stephen> compilers pain. The problem is that *I* have to look for the
    Stephen> yield and might not notice it.

I disagree.  It's not just the compile which has to search for that yield
keyword, we human being reading other's uncommented code (or mis-commented
code) also has to do the same.  It would do much good if the completely
different call convention of generator is made much more explicit in the
definition of the function.

Regards,
Isaac.



More information about the Python-list mailing list