A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-February/138550.html below:

[Python-Dev] how to inspect if something includes a bound first param

[Python-Dev] how to inspect if something includes a bound first param [Python-Dev] how to inspect if something includes a bound first paramTerry Reedy tjreedy at udel.edu
Wed Feb 25 04:25:29 CET 2015
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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4