From: <bc...@wo...> - 2001-04-04 10:40:34
|
[Kent Johnson] >Here is a complete test case. When using the first showData in >MyCallback, it works. With the second callback (as below) it gives > >Traceback (innermost last): > File "<console>", line 1, in ? > File "./Project/Test.py", line 12, in ? >TypeError: showData() takes at least 3 arguments (2 given) Keep in mind that python class can't overload a method name. Instead it can define different numbers of arguments to the same method. Since the python "showData" method will subclass both java showData methods, you will have to figure out which invocation that occured. Something like: def showData(self, inName, inValue=None): if inValue == None: # The "inName" arg is actually a Data instance Test.Callback.showData(self, inName) else: print inName print inValue As you can see, implementing an overloaded java method in python is not a situation where jython shines. regards, finn |