[Python-Dev] CALL_ATTR patch (was: 2.3b1 release) (original) (raw)

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 18 Apr 2003 15:38:30 +1200 (NZST)


There are two ways to "bind" a built-in function to an object.

One would be to do what happens for Python functions, which is in effect a currying: f.get(obj) yields a function g that when called as g(arg1, ...) calls f(obj, arg1, ...).

That's the one I'm talking about. I forgot to explain that the problem occurs when I'm creating a Python class object and populating it with functions that are supposed to be methods. Currently I have to manually wrap each function in an unbound method object before putting it in the class's dict. If that happened automatically on access, I would be able to create Python classes that behave more like the real thing.

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+