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

Victor Stinner victor.stinner at haypocalc.com
Thu Nov 3 01:44:33 CET 2011


> >>> class C:
> ...   def f(): pass
> ...   class D:
> ...     def g(): pass
> ...
> 
> >>> C.D.__qname__
> 'C.D'
> 
> >>> C.D.g.__qname__
> 'C.D.g'
> 
> >>> def f():
> ...   def g(): pass
> ...   return g
> ...
> 
> >>> f().__qname__
> 'f.g'

Oh, +1 just for these examples.

It would help debugging if the __repr__ method of common objects are patched 
to use it.

Victor



More information about the Python-ideas mailing list