On 2/24/2015 9:02 PM, Eric V. Smith wrote:

I'm not sure if it's correct, but deep in a library of mine I have:

elif type(fn) == types.MethodType:
     # bound method?
     if fn.im_self is None:
        # no 'self'
         nskip = 0
     else:
        # need to supply 'self'
         nskip = 1

This is also a 2.x library. No idea if it works with 3.x.

It will not. 3.x does not have 'unbound methods' in the above sense, and for bound methods, fn.im_self is now fn.__self__.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to