My (late) beef with Simple Generator syntax (PEP 255)

Alan Kennedy alanmk at hotmail.com
Thu Nov 14 07:16:31 EST 2002


Cameron Horn wrote:

> Syntactic cruft bothers me; that's why I like Python so much.
> 
> If generators acted like other functions (i.e., could be used
> interchangably) I'd have no problem.  But they can't, so I'm bothered.

I completely see your point, and on reflection, I'm less certain now
that I'm not bothered by it.

It would be certainly be much nicer to specify a null generator using
something like this

gen null():
    pass

However, given that this has proven to be quite a contentious topic
before, and that people who are far more clever and experienced in
language design than I am were unable to reach a clear concensus on the
syntax issue, I think I'm not going to rush in where angels fear to
tread:
I think I'm happy just to live with the slight oddity of the current
syntax, and trust Guido's intuition. 

Here's an example of a thread discussing the subject that could have
turned nasty, if pythonistas weren't such nice people ;-)

http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=mailman.1007665994.20287.python-list%40python.org&rnum=1&prev=/groups%3Fq%3Dg:thl791252731d%26dq%3D%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3Dmailman.1007665994.20287.python-list%2540python.org

regards,

-- 
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan:              http://xhaus.com/mailto/alan



More information about the Python-list mailing list