Re: [Python-ideas] Reuse "for" to express "given"

2018-05-25 Thread Rob Cliffe via Python-ideas
On 24/05/2018 16:54, Alexander Belopolsky wrote: I have read most of the PEP 572 related threads, but I don't think I've seen this idea.  As many other people mentioned, Python already allows a trick to introduce local bindings in generator expressions and list comprehensions.  This can be

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Matt Arcidy
On Thu, May 24, 2018, 14:48 Alexander Belopolsky < alexander.belopol...@gmail.com> wrote: > > > On Thu, May 24, 2018 at 4:59 PM Matt Arcidy wrote: > >> >> >> On Thu, May 24, 2018, 11:47 Alexander Belopolsky < >> alexander.belopol...@gmail.com> wrote: >> >>> > But I do have a

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Alexander Belopolsky
On Thu, May 24, 2018 at 4:59 PM Matt Arcidy wrote: > > > On Thu, May 24, 2018, 11:47 Alexander Belopolsky < > alexander.belopol...@gmail.com> wrote: > >> > But I do have a mathematics background, and I don't remember ever >> seeing >> > "for x = value" used in the sense you

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Matt Arcidy
On Thu, May 24, 2018, 11:47 Alexander Belopolsky < alexander.belopol...@gmail.com> wrote: > > But I do have a mathematics background, and I don't remember ever seeing > > "for x = value" used in the sense you mean. > > That's so because in mathematics, "for" is spelled ":" as in > > {2*a* :

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Alexander Belopolsky
> But I do have a mathematics background, and I don't remember ever seeing > "for x = value" used in the sense you mean. That's so because in mathematics, "for" is spelled ":" as in {2*a* : *a*∈*Z*} If you can read the above, you should not have trouble reading {2*a* + *b* : *a*∈*Z *: *b =

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Steven D'Aprano
On Thu, May 24, 2018 at 11:54:09AM -0400, Alexander Belopolsky wrote: > I have read most of the PEP 572 related threads, but I don't think I've > seen this idea. As many other people mentioned, Python already allows a > trick to introduce local bindings in generator expressions and list >

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread George Leslie-Waksman
I worry about the use of "for" because it will come up in contexts where "for" already has other meanings. In the case of the example list comprehension, the word "for" is being used to mean two entirely different things in a single expression, that seems rather precarious to me. I prefer "with"

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Serhiy Storchaka
24.05.18 18:54, Alexander Belopolsky пише: I have read most of the PEP 572 related threads, but I don't think I've seen this idea.  As many other people mentioned, Python already allows a trick to introduce local bindings in generator expressions and list comprehensions.  This can be achieved

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Robert Vanden Eynde
It was a long time ago I couldn't easily find the post but that's alright, you refreshed the idea :) Let's see what others think of for x = I also remembered some languages (like lua) use for x = range (5) interchangeably with for x in range (5) and guido said it will never make such a thing,

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Alexander Belopolsky
On Thu, May 24, 2018 at 12:04 PM Robert Vanden Eynde wrote: > This idea was mentioned (by me) at a time yes, but wasn't written in the document. Can you point me to a specific post? There were so may that I must have missed that one. > I think one of the thing was that

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Robert Vanden Eynde
This idea was mentioned (by me) at a time yes, but wasn't written in the document. I think one of the thing was that it would make the grammar non LL1 because when seeing the token "for" in a list comprehension it wouldn't know in advance if it's the loop or the assignment. And also, it might

[Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Alexander Belopolsky
I have read most of the PEP 572 related threads, but I don't think I've seen this idea. As many other people mentioned, Python already allows a trick to introduce local bindings in generator expressions and list comprehensions. This can be achieved by adding a "for var in []" clause. I propose