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

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-20 Thread Joshua Morton
This comes from a bit of a misunderstanding of how an interpreter figures out what needs to be compiled. Most (all?) JIT compilers run code in an interpreted manner, and then compile subsections down to efficient machine code when they notice that the same code path is taken repeatedly, so in pypy

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-20 Thread Abe Dillon
On Fri, Feb 17, 2017, Steven D'Aprano wrote: > JIT compilation delays *compiling* the code to run-time. This is a > proposal for delaying *running* the code until such time as some other > piece of code actually needs the result. My thought was that if a compiler is capable of determining what

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

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

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 >

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

[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

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-20 Thread tritium-list
> -Original Message- > From: Python-ideas [mailto:python-ideas-bounces+tritium- > list=sdamon@python.org] On Behalf Of Michel Desmoulin > Sent: Monday, February 20, 2017 3:30 AM > To: python-ideas@python.org > Subject: Re: [Python-ideas] Delayed Execution via Keyword > > I wrote a

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-20 Thread Michel Desmoulin
I wrote a blog post about this, and someone asked me if it meant allowing lazy imports to make optional imports easier. Someting like: lazy import foo lazy from foo import bar So now if I don't use the imports, the module is not loaded, which could also significantly speed up applications