PEP 318

Stephen Horne steve at ninereeds.fsnet.co.uk
Tue Mar 23 04:02:40 EST 2004


On Tue, 23 Mar 2004 11:27:57 +0800, Isaac To <kkto at csis.hku.hk> wrote:

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

Why say "I disagree" if you actually agree with me? As I said...

"""
The problem is that *I* have to look for the yield and might not
notice it.
"""


-- 
Steve Horne

steve at ninereeds dot fsnet dot co dot uk



More information about the Python-list mailing list