From: Kent J. <kjo...@tr...> - 2001-04-03 16:51:30
|
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) Note: If it matters, I am running this from inside the command interpreter using execfile('Test.py', globals()) (because I am on a Mac, no command line). Kent // Test.java package test; public class Test { public static class Data { public String name; public int value; } public static class Callback { public void showData(Data inData) { showData(inData.name, inData.value); } public void showData(String inName, int inValue) { /* empty */ } } public static void testData(Callback inCallback) { Data data = new Data(); data.name = "This is a test"; data.value = 3; inCallback.showData(data); } } # Test.py from test import Test class MyCallback(Test.Callback): # def showData(self, inData): # print inData.name # print inData.value def showData(self, inName, inValue): print inName print inValue Test.testData(MyCallback()) |