OSDir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]# [Python-Dev] Looking for examples: proof that a list comp is a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

- Prev by Date:
**[Python-Dev] bpo-28055: Fix unaligned accesses in siphash24(). (GH-6123)** - Next by Date:
**[Python-Dev] Looking for examples: proof that a list comp is a function** - Previous by thread:
**[Python-Dev] bpo-28055: Fix unaligned accesses in siphash24(). (GH-6123)** - Next by thread:
**[Python-Dev] Looking for examples: proof that a list comp is a function** - Index(es):