> Is there a replacement in Python3 for new.instancemethod? I think I can answer my own question: functools.partial:
>>> class C: ... pass ... >>> def meth(self, x): ... self.x = x ... >>> c = C() >>> c.meth = meth >>> c.meth(5) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: meth() takes exactly 2 positional arguments (1 given) >>> import functools >>> c.meth = functools.partial(meth, c) >>> c.meth(5) >>> c.x 5 Is this the "one obvious" way to do this in Python3? -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ "XML sucks, dictionaries rock" - Dave Beazley -- http://mail.python.org/mailman/listinfo/python-list