New submission from Roman Rader: Some strange behavior is observed while method in object substitutes with callable object.
For example: ------------------------------------- class Meth(object): def __call__(*args, **kwargs): print (args, kwargs) class X(object): def some_method(*args, **kwargs): print (args, kwargs) x = X() x.some_method(1) X.some_method = Meth() x.some_method(1) ------------------------------------- Output (<__main__.X object at 0xb72d408c>, 1) {} (<__main__.Meth object at 0xb72d40cc>, 1) {} ------------------------------------- So, second call lost caller object ("self"). I suppose second output should be (<__main__.Meth object ...>, <__main__.X object ...>, 1) {} Tested in Python 2.7 and Python 3.3. ---------- components: Interpreter Core messages: 186410 nosy: Roman.Rader priority: normal severity: normal status: open title: self is lost if methods are callable objects versions: Python 2.7, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17680> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com