Re: [Python-Dev] list splicing

2005-10-20 Thread Christos Georgiou
"Greg Ewing" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Karl Chen wrote: >> Hi, has anybody considered adding something like this: >> a = [1, 2] >> [ 'x', *a, 'y'] >> >> as syntactic sugar for >> a = [1, 2] >> [ 'x' ] + a + [ 'y' ]. > > You can write that as >

Re: [Python-Dev] list splicing

2005-09-19 Thread Fred L. Drake, Jr.
On Monday 19 September 2005 19:20, Raymond Hettinger wrote: > It might have a chance of acceptance this time if the proponents stick > with unpacking at the end: a,b,*c=sometup instead of a,*b,c=sometup. > The latter has usually gotten shot down quickly, taking the former down > with it. Tr

Re: [Python-Dev] list splicing

2005-09-19 Thread Raymond Hettinger
[Fred L. Drake] > Indeed, "star unpacking" has been brought up many times; I think it would > be > really cool myself. It might have a chance of acceptance this time if the proponents stick with unpacking at the end: a,b,*c=sometup instead of a,*b,c=sometup. The latter has usually gotten shot

Re: [Python-Dev] list splicing

2005-09-19 Thread Fred L. Drake, Jr.
On Monday 19 September 2005 16:36, Michael Chermside wrote: > 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

Re: [Python-Dev] list splicing

2005-09-19 Thread Michael Chermside
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 comple

Re: [Python-Dev] list splicing

2005-09-19 Thread Josiah Carlson
Gareth McCaughan <[EMAIL PROTECTED]> wrote: > The problems with syntax are > > 1 It adds cognitive load. > 2 It makes your code look like line noise. > 3 It reduces options for future development. > 4 It complicates the parser. > > I don't know about #4, but I suspect it (along with the

Re: [Python-Dev] list splicing

2005-09-19 Thread Gareth McCaughan
On Monday 2005-09-19 06:38, Josiah Carlson wrote: > > > [ 'x', *a, 'y'] > > > > > > as syntactic sugar for > > > > > > [ 'x' ] + a + [ 'y' ]. > > > > > > Notes: > > > - This is a common operation > > > > is it? > > Not in the code that I read/use. While "not all 3 line functions should

Re: [Python-Dev] list splicing

2005-09-18 Thread Josiah Carlson
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > > Karl Chen wrote: > > > Hi, has anybody considered adding something like this: > > a = [1, 2] > > [ 'x', *a, 'y'] > > > > as syntactic sugar for > > a = [1, 2] > > [ 'x' ] + a + [ 'y' ]. > > > > Notes: > > - This is a common operation

Re: [Python-Dev] list splicing

2005-09-18 Thread Greg Ewing
Karl Chen wrote: > Hi, has anybody considered adding something like this: > a = [1, 2] > [ 'x', *a, 'y'] > > as syntactic sugar for > a = [1, 2] > [ 'x' ] + a + [ 'y' ]. You can write that as a = [1, 2] a[1:1] = a Greg ___ Python-

Re: [Python-Dev] list splicing

2005-09-18 Thread Fredrik Lundh
Karl Chen wrote: > Hi, has anybody considered adding something like this: > a = [1, 2] > [ 'x', *a, 'y'] > > as syntactic sugar for > a = [1, 2] > [ 'x' ] + a + [ 'y' ]. > > Notes: > - This is a common operation is it? ___ Python-De

[Python-Dev] list splicing

2005-09-18 Thread Karl Chen
Hi, has anybody considered adding something like this: a = [1, 2] [ 'x', *a, 'y'] as syntactic sugar for a = [1, 2] [ 'x' ] + a + [ 'y' ]. Notes: - This is a common operation - To me, the splicing form looks much better than the concatenation form - It can be implemented more ef