Style question on recursive generators

Carlos Ribeiro carribeiro at gmail.com
Tue Oct 19 16:34:52 CEST 2004


On Tue, 19 Oct 2004 01:23:37 +0000, Dima Dorfman
<d+pylist at nospamplease.trit.org> wrote:
> Alex Martelli <aleaxit at yahoo.com> wrote:
> > If the issue is strictly one of whether it's worth somehow making
> >     for x in y: yield x
> > terser (by a new kw, combination of kw, and/or punctuation) I guess we
> > can discuss that (I just don't see the gain to offset the price of
> > introducing new syntax and one more language thing to learn for
> > Pythonistas and newcomers to Python).
> 
> I find myself writing a lot of recursive generators, and a while ago I
> implemented this:
> 
>   yield *other
> 
> to mean:
> 
>   for x in other:
>     yield x

Just a clarification. You _implemented_ it as a patch to Python, or
using some clever trick that I'm not aware of? Or did you just write a
specification?


-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list