[Python-ideas] Unpack of sequences

Masklinn masklinn at masklinn.net
Wed Aug 29 15:54:39 CEST 2012


On 29 août 2012, at 15:50, Carlo Pires <carlopires at gmail.com> wrote:
> Hi,
> 
> I was just wondering why unpack of sequences did not follow same behavior of functions parameters. I mean:
> 
> first, *rest = 'a b c'.split()
> 
> should work in python, why doesn't it?

It does work in python 3, and following p3's improved unpacking semantics. 

Demo: http://pythonic.pocoo.org/2008/2/17/new-in-python-3:-extended-unpacking

Pep: http://www.python.org/dev/peps/pep-3132/


More information about the Python-ideas mailing list