[Python-ideas] PEP 3155 - Qualified name for classes and functions

Antoine Pitrou solipsis at pitrou.net
Sun Oct 30 21:51:14 CET 2011


On Sun, 30 Oct 2011 16:41:42 -0400
Nikolaus Rath <Nikolaus at rath.org> wrote:
> Antoine Pitrou <solipsis at pitrou.net> writes:
> > This PEP proposes the addition of a ``__qname__`` attribute to functions
> > and classes.  For top-level functions and classes, the ``__qname__``
> > attribute is equal to the ``__name__`` attribute.  For nested classed,
> > methods, and nested functions, the ``__qname__`` attribute contains a
> > dotted path leading to the object from the module top-level.
> 
> Did you consider making it an array of the actual class/function objects
> instead of a string? It seems to me that going from the actual objects
> to the string representation is much easier than having to go the other
> way around.

That would add a ton of references and reference cycles, keeping
objects alive while they really shouldn't, and making cleanup in the
face of __del__ methods much more problematic than it already is.

Regards

Antoine.





More information about the Python-ideas mailing list