A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-May/153521.html below:

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

[Python-Dev] Looking for examples: proof that a list comp is a function [Python-Dev] Looking for examples: proof that a list comp is a functionChris Angelico rosuav at gmail.com
Mon May 14 03:30:40 EDT 2018
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 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.

So I'm looking for examples that prove that a list comp is executed
inside an implicit function. Ideally, examples that are supported by
language guarantees, but something that's "CPython has done it this
way since 3.0" is important too.

I'm aware of just two: the name lookup interaction that may be
changing, and the fact that there's an extra line in a traceback. And
the latter, as far as I know, is not guaranteed (and I doubt anyone
would care if it changed). Are there any other provable points?

ChrisA
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4