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 related

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 complex, but

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 at

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

[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

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? /F ___ Python-Dev

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-Dev

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 is it? Not in the