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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jan 28 23:27:13 CET 2005


Guido van Rossum wrote:

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 thought the main reason for existence of unbound methods (for user-defined classes, at least) was so that if you screw up a super call by forgetting to pass self, or passing the wrong type of object, you get a more helpful error message.

I remember a discussion about this some years ago, in which you seemed to think the ability to produce this message was important enough to justify the existence of unbound methods, even though it meant you couldn't easily have static methods (this was long before staticmethod() was created).

Have you changed your mind about that?

Also, surely unbound methods will still have to exist for C methods? Otherwise there will be nothing to ensure that C code is getting the object type it expects for self.

-- Greg



More information about the Python-Dev mailing list