[Python-3000] Using *a for packing in lists and other places

Michael Urman murman at gmail.com
Sun Mar 16 00:33:53 CET 2008


> > I'm not sure how to solve this except by adopting a different syntax
> > for the multiple-yield. Perhaps
> >
> > *yield x
>
> If there really were an inconsistency here, I would certainly not suggest
> fixing it that way, yuuueghh.

Agreed about *yield looking yucky. In a previous thread somewhere
around http://mail.python.org/pipermail/python-dev/2006-January/059955.html
a construct like "yield from x" was offered. It certainly helps
clarify the difference between iteratively yielding the values from
another iterator and yielding the values of an iterator as a tuple.
While parsing rules do differentiate, I don't find the behavior
obvious, and expect the differences between
    yield *x; yield *x(); yield *x,; yield (*x,); and yield *(x,)
would become one of python's warts in a few years, if adopted. In
short, I don't think * should be the syntax for iterative-yielding.

That said, all these star extensions call to me, especially
arbitrarily positioned *args in function calls and iteratively
yielding items from another iterator. But I can't offer any use new
cases.
-- 
Michael Urman


More information about the Python-3000 mailing list