Why is Python popular, while Lisp and Scheme aren't?
Michael Hudson
mwh at python.net
Thu Nov 28 05:06:35 EST 2002
Courageous <jkraska at san.rr.com> writes:
> I still disagree with the decision to not have a defgenerator clause
> (or equivalent) however. BDFL pronuncements in the PEP notwithstanding.
Live with it.
> For one thing, had yield not been meant to imply generator in the
> context of the function in which it is used, yield could have been
> executed in the body of a function which perculated that being
> yielded to the first appropriate defgenerator in the invocation
> stack, somewhat like a limited kind of continuation. To wit:
>
> defgenerator g ():
>
> f()
>
> def f():
>
> while 1:
>
> yield None
>
> x = g()
>
> while x.next():
>
> something()
>
> Ddon't know about actual _implementation_ mind you, but it struck
> me that it would be quite useful if "yield" actually raised something
> that was next()able. x = g() would therefore be syntactic sugar for
> "except Continuable, c:"
You'd have to know at compile time whether g() referred to a generator
of not, wouldn't you? That ain't gonna work.
Cheers,
M.
--
Reading Slashdot can [...] often be worse than useless, especially
to young and budding programmers: it can give you exactly the wrong
idea about the technical issues it raises.
-- http://www.cs.washington.edu/homes/klee/misc/slashdot.html#reasons
More information about the Python-list
mailing list