[Python-Dev] Let's get rid of unbound methods
Bob Ippolito
bob at redivi.com
Tue Jan 4 19:39:44 CET 2005
On Jan 4, 2005, at 1:28 PM, Guido van Rossum wrote:
> Let's get rid of unbound methods. When class C defines a method f, C.f
> should just return the function object, not an unbound method that
> behaves almost, but not quite, the same as that function object. The
> extra type checking on the first argument that unbound methods are
> supposed to provide is not useful in practice (I can't remember that
> it ever caught a bug in my code) and sometimes you have to work around
> it; it complicates function attribute access; and the overloading of
> unbound and bound methods on the same object type is confusing. Also,
> the type checking offered is wrong, because it checks for subclassing
> rather than for duck typing.
+1
I like this idea. It may have some effect on current versions of
PyObjC though, because we really do care about what self is in order to
prevent crashes. This is not a discouragement; we are already using
custom descriptors and a metaclass, so it won't be a problem to do this
ourselves if we are not doing it already. I'll try and find some time
later in the week to play with this patch to see if it does break
PyObjC or not. If it breaks PyObjC, I can sure that PyObjC 1.3 will be
compatible with such a runtime change, as we're due for a refactoring
in that area anyway.
-bob
More information about the Python-Dev
mailing list