[Python-Dev] Extending tuple unpacking

Ron Adam rrr at ronadam.com
Wed Oct 12 22:52:20 CEST 2005

Nick Coghlan wrote:
> Ron Adam wrote:
>>I wonder if something like the following would fulfill the need?
> Funny you should say that. . .
> A pre-PEP propsing itertools.iunpack (amongst other things):
> http://mail.python.org/pipermail/python-dev/2004-November/050043.html
> And the reason that PEP was never actually created:
> http://mail.python.org/pipermail/python-dev/2004-November/050068.html
> Obviouly, I've changed my views over the last year or so ;)
> Cheers,
> Nick.

It looked like the PEP didn't get created because there wasn't enough
interest at the time, not because there was anything wrong with the
idea.  And the motivation was, suprisingly, that this would be
discussed again, and here it is.  ;-)

I reversed my view in the other direction in the past 6 months or so. 
Mostly because when chaining methods or functions with * and **, my mind 
(which often doesn't have enough sleep), want's to think they mean the 
same thing in both ends of the method.

For example... (with small correction from the previous example)

     def div_at(self, *args):
         return self.__class__(self.div_iter(*args))

This would read better to me if it was.

     # (just an example, not a sugestion.)

     def div_at(self, *args):
         return self.__class__(self.div_iter(/args))

But I may be one of a few that this is a minor annoyance.  <shrug>

I wonder if you make '*' work outside of functions arguments lists, if
requests to do the same for '**' would follow?


More information about the Python-Dev mailing list