[Python-Dev] lament for the demise of unbound methods (original) (raw)
Ronald Oussoren ronaldoussoren at mac.com
Thu Jul 4 13:55:58 CEST 2013
- Previous message: [Python-Dev] lament for the demise of unbound methods
- Next message: [Python-Dev] lament for the demise of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4 Jul, 2013, at 13:21, Chris Withers <chris at simplistix.co.uk> wrote:
Hi All,
In Python 2, I can figure out whether I have a method or a function, and, more importantly, for an unbound method, I can figure out what class the method belongs to: >>> class MyClass(object): ... def method(self): pass ... >>> MyClass.method >>> MyClass.method.imclass <class '_main_.MyClass'> There doesn't appear to be any way in Python 3 to do this, which is a little surprising and frustrating... What am I missing here?
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'
Ronald
Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
- Previous message: [Python-Dev] lament for the demise of unbound methods
- Next message: [Python-Dev] lament for the demise of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]