[Python-Dev] list splicing

Michael Chermside mcherm at mcherm.com
Mon Sep 19 22:36:59 CEST 2005


Karl Chen writes:
> Hi, has anybody considered adding something like this:
>     a = [1, 2]
>     [ 'x', *a, 'y']
>
> as syntactic sugar for
>     a = [1, 2]
>     [ 'x' ] + a + [ 'y' ].

A bit later in the thread, Josiah Carlson replies:
> I don't think the parser would get measureably more complex, but I
> believe that any work to support this uncommon (from my experience)
> operation, rather than the dozens of other usable RFEs in the tracker,
> would be misspent time.

I'd just like to point out that this is a FRF (Frequently Requested
Feature). I'm not arguing in favor of it, just pointing out that
using "star unpacking" in tuple and list literals is an idea that
I'm sure I've seen proposed at least a couple of times before.

This doesn't necessarily make it a good idea, nor a bad one.

-- Michael Chermside



More information about the Python-Dev mailing list