[Python-Dev] Getting rid of unbound methods: patch available (original) (raw)

Guido van Rossum gvanrossum at gmail.com
Mon Jan 17 07:12:37 CET 2005


https://sourceforge.net/tracker/index.php?func=detail&aid=1103689&group_id=5470&atid=305470

Here's a patch that gets rid of unbound methods, as discussed here before. A function's get method now returns the function unchanged when called without an instance, instead of returning an unbound method object.

I couldn't remove support for unbound methods completely, since they were used by the built-in exceptions. (We can get rid of that use once we convert to new-style exceptions.)

For backward compatibility, functions now have read-only im_self and im_func attributes; im_self is always None, im_func is always the function itself. (These should issue warnings, but I haven't added that yet.)

The test suite passes. (I have only tried "make test" on a Linux box.)

What do people think? (My main motivation for this, as stated before, is that it adds complexity without much benefit.)

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list