Re: [Python-Dev] Looking for examples: proof that a list comp is a function

2018-05-15 Thread Tim Peters
[ Tim, about the most version of the docs at https://docs.python.org/dev/reference/expressions.html#displays-for-lists-sets-and-dictionaries ] >> I say "pretty much" because, for whatever reason(s), it seems to be >> trying hard _not_ to use the word "function". But I can't guess what >> "the

Re: [Python-Dev] Looking for examples: proof that a list comp is a function

2018-05-14 Thread Nick Coghlan
On 14 May 2018 at 04:05, Tim Peters wrote: > I say "pretty much" because, for whatever reason(s), it seems to be > trying hard _not_ to use the word "function". But I can't guess what > "then passed as an argument to the implicitly nested scope" could > possibly mean otherwise (it doesn't make l

Re: [Python-Dev] Looking for examples: proof that a list comp is a function

2018-05-14 Thread Tim Peters
[Chris Angelico ... > With current semantics, you can easily prove that a list comp is > implemented with a function by looking at how it interacts with other > scopes (mainly class scope), but Tim's proposal may change that. Absolutely not. I haven't considered for a nanosecond that anything _e

Re: [Python-Dev] Looking for examples: proof that a list comp is a function

2018-05-14 Thread Franklin? Lee
On Mon, May 14, 2018, 03:36 Chris Angelico wrote: > Guido has stated that this parallel is desired and important: > > result = [f(x) for x in iter if g(x)] > result = list(f(x) for x in iter if g(x)) > > Obviously the genexp has to be implemented with a nested function, > since there's no guarant

[Python-Dev] Looking for examples: proof that a list comp is a function

2018-05-14 Thread Chris Angelico
Guido has stated that this parallel is desired and important: result = [f(x) for x in iter if g(x)] result = list(f(x) for x in iter if g(x)) Obviously the genexp has to be implemented with a nested function, since there's no guarantee that it'll be iterated over in this way. With current semanti