Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17054

Re: Verbose and flexible args and kwargs syntax

References <4EE5C576.2000307@gmail.com> <jc57vr$k15$1@dough.gmane.org>
Date 2011-12-12 16:10 +0000
Subject Re: Verbose and flexible args and kwargs syntax
From Arnaud Delobelle <arnodel@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3552.1323706204.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 12 December 2011 15:52, Terry Reedy <tjreedy@udel.edu> wrote:

> No, *target unpacking (singular) is quite useful in specialized cases. But
> it is not specifically head/tail unpacking.
>
>>>> a,*b,c = 1,2,3,4,5,6
>>>> a,b,c
> (1, [2, 3, 4, 5], 6)
>>>> *a,b,c = 1,2,3,4,5
>>>> a,b,c
> ([1, 2, 3], 4, 5)
>
>> I personally quite like them, but I would like them to be more general.
>
>
> It already is. The *target can be anywhere in the sequence.
>
> --
> Terry Jan Reedy

You can even have nested sequences!

>>> a, (b, *c), *d = 1, "two", 3, 4

-- 
Arnaud

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Verbose and flexible args and kwargs syntax Arnaud Delobelle <arnodel@gmail.com> - 2011-12-12 16:10 +0000

csiph-web