Pythonification of the asterisk-based collection packing/unpacking syntax

Rick Johnson rantingrickjohnson at gmail.com
Tue Dec 27 20:11:49 EST 2011


On Dec 27, 5:10 pm, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Sun, 25 Dec 2011 07:47:20 -0800, Eelco wrote:
> Your original use-case, where you want to change the type of tail from a
> list to something else, is simply solved by one extra line of code:
>
> head, *tail = sequence
> tail = tuple(tail)

i wonder if we could make this proposal a bit more "Pythonic"? Hmm...

head, tuple(tail) = sequence

...YEP!



More information about the Python-list mailing list