Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 11:07:07 +, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 10:54:46 +, Helmut Jarausch wrote: > >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >>code= ... >>args= ... >># Add function header >>code

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 10:52:11 +, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 09:50:35 +, Helmut Jarausch wrote: > >> Hi, >> >> I'm trying to port a class to Python3.3 which contains >> >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >> >

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 10:54:46 +, Helmut Jarausch wrote: > class Foo : > > def to_binary(self, *varargs, **keys): > >code= ... >args= ... ># Add function header >code = 'def to_binary(self, %s):\n' % ', '.join(args) + code >exec(c

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 11:41:46 +0100, Arnaud Delobelle wrote: > On 7 April 2013 10:50, Helmut Jarausch wrote: >> Hi, >> >> I'm trying to port a class to Python3.3 which contains >> >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >> >> >> self.to

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 09:50:35 +, Helmut Jarausch wrote: > Hi, > > I'm trying to port a class to Python3.3 which contains > > class Foo : > > def to_binary(self, *varargs, **keys): > > > self.to_binary = new.instancemethod(to_binary, self, self.__class__)

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Arnaud Delobelle
On 7 April 2013 10:50, Helmut Jarausch wrote: > Hi, > > I'm trying to port a class to Python3.3 which contains > > class Foo : > > def to_binary(self, *varargs, **keys): > > > > self.to_binary = new.instancemethod(to_binary, self, self.__class__) `self` isn'