On Thu, Jul 4, 2013 at 5:21 AM, Chris Withers <ch...@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 > <unbound method MyClass.method> > >>> MyClass.method.im_class > <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
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com