determining the number of output arguments

Josiah Carlson jcarlson at uci.edu
Tue Nov 16 02:43:55 EST 2004


Jeremy Bowers <jerf at jerf.org> wrote:
> 
> On Mon, 15 Nov 2004 19:44:06 -0800, Josiah Carlson wrote:
> >> I think it would be better to have a way to say 'and all the rest'.
> >> Lacking that, some automated way to count how many items are being
> >> unpacked on the LHS is probably second-best.
> > 
> > Is it worth a keyword, or would a sys.getframe()/bytecode hack be
> > sufficient?
> 
> Who needs a keyword?
> 
> a, b, *c = [1, 2, 3, 4]
> a, b, *c = [1, 2]


I'll post the same thing that was posted by James Knight on python-dev
about this precise syntax...


James Knight wrote:
> Two threads on the topic, with rejections by Guido:
> http://mail.python.org/pipermail/python-dev/2002-November/030349.html
> http://mail.python.org/pipermail/python-dev/2004-August/046684.html
> 
> Guido's rejection from 
> http://mail.python.org/pipermail/python-dev/2004-August/046794.html:
> > For the record, let me just say that I'm -1 on adding this feature
> > now.  It's only a minor convenience while it's a fairly big change to
> > the parser and code generator, but most of all, Python's growth needs
> > to be reduced.  If we were to add every "nice" feature that was
> > invented (or present in other languages), Python would lose one of its
> > main charms, which is that it is really a rather simple language that
> > can be learned and put to production quickly.
> >
> > So while I appreciate the idea (which BTW has been proposed before) I
> > think it's not worth adding now, and if you don't hear from me again
> > on this topic it's because I haven't changed my mind...


Guido hasn't updated his stance, so don't hold your breath.

 - Josiah




More information about the Python-list mailing list