[Python-Dev] lament for the demise of unbound methods

Chris Withers chris at simplistix.co.uk
Thu Jul 4 14:16:12 CEST 2013


On 04/07/2013 12:55, Ronald Oussoren wrote:
>
> You can find the fully qualified name of the method with the qualname attribute:
>
>>>> class A:
> ...    def method(self): pass
> ...
>>>> A.method.__qualname__
> 'A.method'

That doesn't seem helpful as a sensible way to get back to the class object:

 >> globals()[MyClass.method.__qualname__.split('.')[0]]
<class '__main__.MyClass'>

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk


More information about the Python-Dev mailing list