Message1266
I have a small program which make me like python very
much, run well in python2.4(also 2.5),
but fail to run in Jython(jythonRelease_2_2alpha1).
[code]
class C1(object):
def v(self, o):
return "expected "+o
class C2(object):
def m(self):
print self.v("aaa")
class C3(object):pass
from types import MethodType
def addMethod(obj, meth):
f = meth.im_func
setattr(obj, f.__name__, MethodType(f,obj))
def test1():
o = C3()
addMethod(o, C2.m)
addMethod(o, C1.v)
o.m()
test1()
print C1.v.im_func(None,"xxx")
[/code]
> jython.bat d:\neo\py\oop.py
Traceback (innermost last):
File "d:\neo\py\oop.py", line 24, in ?
File "d:\neo\py\oop.py", line 19, in test1
File "d:\neo\py\oop.py", line 15, in addMethod
TypeError: _new_impl(): expected 3 args; got 2
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:34 | admin | link | issue1577969 messages |
2008-02-20 17:17:34 | admin | create | |
|