.0 in name

Eryk Sun eryksun at gmail.com
Sat May 28 18:26:50 EDT 2022


On 5/28/22, Chris Angelico <rosuav at gmail.com> wrote:
>
> be extremely confusing; so to keep everything safe, the interpreter
> generates a name you couldn't possibly want - same as for the function
> itself, which is named "<listcomp>" or "<genexpr>", angle brackets
> included.

To clarify, "<listcomp>" is the co_name and co_qualname value of the
code object, which was compiled for the list comprehension. These
names are also used as the __name__ and __qualname__ of the temporary
object that's created by MAKE_FUNCTION. They are not identifiers. The
code object is a constant, which is referenced solely by its index in
the co_consts tuple. The temporary function is referenced on the
stack.


More information about the Python-list mailing list