On Tue, 08 Jul 2008 17:56:45 -0400, Joseph Barillari wrote: > Hi python-list, > > I've just started using new-style classes and am a bit confused as to > why I can't seem to alter methods with special names (__call__, etc.) of > new-style class instances.
[deploy weapon of mass snippage] Here is a possible work-around: >>> class Special(object): ... def __call__(self): ... try: ... return self.__dict__['__call__']() ... except KeyError: ... return 'foo' ... >>> s = Special() >>> s() 'foo' >>> s.__call__ = lambda: 'bar' >>> s() 'bar' -- Steven -- http://mail.python.org/mailman/listinfo/python-list