G
George Sakkis
Hi all,
I wonder why types.MethodType fails under python 2.2:
Python 2.2.2 (#1, Jun 25 2003, 18:52:43)
[GCC 3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information..... def f(self,attr): return getattr(self,attr)
.... g = types.MethodType(f,None)
....
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 3, in X
TypeError: cannot create 'instance method' instances
The same code under 2.4 (and I believe 2.3) runs fine.
Python 2.4b1 (#1, Oct 25 2004, 17:07:48)
[GCC 3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information..... def f(self,attr): return getattr(self,attr)
.... g = types.MethodType(f,None)
....<bound method X.f of <__main__.X instance at 0x2a97f23e60>>
Is it possible to get around this in 2.2 ? Thanks in advance,
George
I wonder why types.MethodType fails under python 2.2:
Python 2.2.2 (#1, Jun 25 2003, 18:52:43)
[GCC 3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information..... def f(self,attr): return getattr(self,attr)
.... g = types.MethodType(f,None)
....
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 3, in X
TypeError: cannot create 'instance method' instances
The same code under 2.4 (and I believe 2.3) runs fine.
Python 2.4b1 (#1, Oct 25 2004, 17:07:48)
[GCC 3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information..... def f(self,attr): return getattr(self,attr)
.... g = types.MethodType(f,None)
....<bound method X.f of <__main__.X instance at 0x2a97f23e60>>
Is it possible to get around this in 2.2 ? Thanks in advance,
George