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

David Eppstein eppstein at ics.uci.edu
Wed Nov 13 16:55:06 EST 2002


In article <3DD2C505.96B41A1C at hotmail.com>,
 Alan Kennedy <alanmk at hotmail.com> wrote:

> Cameron Horn wrote:
> 
> > If I want to write an empty generator, I write this(?):
> > def foo():
> >   return
> >   yield "never"
> 
> What is the semantic of "an empty generator", i.e. what does it mean? A
> generator that never generates any values?

What I wonder is, why does it need to be a generator?  What's wrong with
def foo(): return ( )
?

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list