Re: [Python-ideas] List indexing multiple elements

2017-02-20 Thread David Mertz
On Mon, Feb 20, 2017 at 12:54 PM, Ryan Gonzalez wrote: > elements = [mylist[a], mylist[b]] > - Right now, a[b,c] is already valid syntax, since it's just indexing a > with the tuple (b, c). The proposal is to make this a specialization in the > grammar, and also allow stuff like a[b:c, d:e] (like

Re: [Python-ideas] List indexing multiple elements

2017-02-20 Thread Paul Moore
On 20 February 2017 at 20:54, Ryan Gonzalez wrote: > Apologies if this has already been covered! > > Right now, if you want to get multiple elements in a list, you have to do: > > elements = [mylist[a], mylist[b]] > > My proposal is two-folded: > > - Right now, a[b,c] is already valid syntax, sinc

Re: [Python-ideas] List indexing multiple elements

2017-02-20 Thread Ivan Levkivskyi
On 20 February 2017 at 22:05, Jonathan Goble wrote: > On Mon, Feb 20, 2017 at 3:55 PM Ryan Gonzalez wrote: > >> - Right now, a[b,c] is already valid syntax, since it's just indexing a >> with the tuple (b, c). The proposal is to make this a specialization in the >> grammar, and also allow stuff

Re: [Python-ideas] List indexing multiple elements

2017-02-20 Thread Jonathan Goble
On Mon, Feb 20, 2017 at 3:55 PM Ryan Gonzalez wrote: > - Right now, a[b,c] is already valid syntax, since it's just indexing a > with the tuple (b, c). The proposal is to make this a specialization in the > grammar, and also allow stuff like a[b:c, d:e] (like > `a.__getitem__(slice(b, c), slice(d

Re: [Python-ideas] List indexing multiple elements

2017-02-20 Thread Ryan Birmingham
So, to make sure I have this right: your proposal says array should be indexable by a list of indexes as they're currently done, in a tuple, right? Would this also mean that something like (1:4, 8:10, 13) should be an acceptable constructor for a tuple? -Ryan Birmingham On 20 February 2017 at 15:

[Python-ideas] List indexing multiple elements

2017-02-20 Thread Ryan Gonzalez
Apologies if this has already been covered! Right now, if you want to get multiple elements in a list, you have to do: elements = [mylist[a], mylist[b]] My proposal is two-folded: - Right now, a[b,c] is already valid syntax, since it's just indexing a with the tuple (b, c). The proposal is to m