__qualname__ exposed as a local variable: standard?

eryk sun eryksun at gmail.com
Sat Jul 9 14:52:33 EDT 2016


On Sat, Jul 9, 2016 at 4:08 AM,  <carlosjosepita at gmail.com> wrote:
>
> I noticed __qualname__ is exposed by locals() while defining a class.

This is an undocumented implementation detail used to pass this
information to the metaclass. You'll also see __module__ and, if the
class has a docstring, __doc__. For CPython, this is implemented in
the functions compiler_class (for __module__ and __qualname__) and
compiler_body (for __doc__), which you'll find in Python/compile.c.



More information about the Python-list mailing list