From: Tom W. <to...@ss...> - 2001-04-04 17:21:45
|
Please pardon my basic "newbie" question...I've not been able to find the answer to this in the tutorial, in O'Reilly, or thru web searching. I am making a .py file with a bunch of methods. I'd like to overload (at least) one of them, like: def mything(a,b,c) print a,b,c def mything(a,b) print a,b What I've found is that only the last one in the .py file seems to be called every time. If I try to reference the above with: file.mything(1,2,3) I get an error message like: "not enough arguments; expected 3 got 2". I've overcome this by using a single method like: def mything(*a) and looking at the len(a). Since Jython does such a great job when trying to figure out which overloaded method to use in a Java class, I thought I must be missing something. Is there a better/preferred way to accomplish this? Thanks ahead for your advice & guidance, tom -- Tom Whittaker (to...@ss...) University of Wisconsin-Madison Space Science and Engineering Center Phone/VoiceMail: 608/262-2759 Fax: 608/262-5974 |