[Python-Dev] lament for the demise of unbound methods (original) (raw)
Eric Snow ericsnowcurrently at gmail.com
Thu Jul 4 20:05:08 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 Thu, Jul 4, 2013 at 5:21 AM, 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 could always monkeypatch builtins.build_class to add an attribute to every "unbound method" pointing to the class.
-eric -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130704/719c49dd/attachment.html>
- 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 ]