[Jepp-users] java signature for overriding python methods
Brought to you by:
mrjohnson0
From: James M. <jam...@gm...> - 2012-11-26 16:55:27
|
In java, I would like to create an object which has the __getitem__ defined so that in python I can interact with this class with the [] notation. Similar to the following... public class Asdf { public Object __getitem__(Object arg) { return "5"; } public Object __getitem__(int arg) { return "4"; } } Then in python file, I can do... fromJava = Asdf() print fromJava.__getitem__(4) print fromJava[4] the call to __getitem__ works, but the call to [4] does not. I imagine I just have the signature wrong, but I am unsure where to look to get the correct signature. Does anyone know the answer, or have a better place I can look to find it? Thanks, James Mahler |