Some language proposals.

Josiah Carlson jcarlson at
Fri Mar 5 08:27:26 CET 2004

[snip classes not behaving like class instances]

I see.  You are not happy with the fact that instances of some other 
class, with a __call__ method are not considered a bound instance 
method.  I'm sure you have thought of it, but I would wrap it.  It may 
take another function call, but really, what other functionality do you 
need that the below does not provide?

Give the below a shot.

  - Josiah

class callee:
     def __call__(s, self, *args):
         print self

def instance(self, *args):
     print self

def wrapper(self, *args):
     print self
     self._c(self, *args)

class caller:

caller.instance_method = instance
caller.instance_method2 = wrapper
foo = caller()
caller._c = callee()


More information about the Python-list mailing list