PEP 255: Simple Generators
Denys Duchier
Denys.Duchier at ps.uni-sb.de
Tue Jun 19 17:55:26 EDT 2001
The one thing that rubs me the wrong way with this proposal is that it
is not compositional. Unless I misread the PEP, the entire generation
logic must be defined in a single function (because the `yield'
keyword must statically occur within the body of the generator
function). This makes it impossible to use higher-order programming
to assemble complex generators from smaller blocks.
One way to address this issue would be to make the dynamic bracketing
explicit, for example as an annotation on the function which is
intended to wrap the generator (this has been proposed by many, albeit
for different reasons).
I won't make a proposal of my own, but I'll just point out that the
issue is very much related to the old duality control/prompt
(Felleisen) or later shift/reset (Filinski) in the continuation world.
Cheers,
--
Dr. Denys Duchier Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme (Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45 http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50 Phone: +49 681 302 5618
66041 Saarbruecken, Germany Fax: +49 681 302 5615
More information about the Python-list
mailing list