You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Slicing a Python list converted from Java fails #24
what's the reason we still have JavaCollection, JavaList etc. in scyjava? Is there additional functionality to what JPype brings?
Lack of testing, and maintenance of the status quo. I'd be happy to get rid of them if we beef up unit tests to prove that JPype is strictly better. Or if we find advantages to keeping them, perhaps they could be slimmed down to extend some JPype data structures where feasible.
JPype collections should be fully supporting of Python collections API or at least as much as it is possible using Java's available functions. You can add additional functionality through customizers like the ones in _jcollection.
For example, if you wish to add a toPython() method to String[] which returns a "list of str" just define the function in a class and add the JImplementationFor decorator so it monkey patches it in. I don't generally add anything beyond the minimum to satisfy the Python contracts, but jpype does support multiple user installed customizer to any Java type so long as there are no implementation conflicts. In some projects I have "jdouble[]" overloaded with math operations.
Activity
imagejan commentedon Feb 19, 2021
Interestingly, the following both work:
imagejan commentedon Feb 19, 2021
Probably would require copying the
slicelogic from here:https://github.com/jpype-project/jpype/blob/8a32c42373ca10e0aa587d5fab0065dab52f94c6/jpype/_jcollection.py#L89-L96
@ctrueden what's the reason we still have
JavaCollection,JavaListetc. inscyjava? Is there additional functionality to what JPype brings?ctrueden commentedon Feb 19, 2021
Lack of testing, and maintenance of the status quo. I'd be happy to get rid of them if we beef up unit tests to prove that JPype is strictly better. Or if we find advantages to keeping them, perhaps they could be slimmed down to extend some JPype data structures where feasible.
Thrameos commentedon Feb 19, 2021
JPype collections should be fully supporting of Python collections API or at least as much as it is possible using Java's available functions. You can add additional functionality through customizers like the ones in
_jcollection.For example, if you wish to add a
toPython()method toString[]which returns a "listofstr" just define the function in a class and add theJImplementationFordecorator so it monkey patches it in. I don't generally add anything beyond the minimum to satisfy the Python contracts, but jpype does support multiple user installed customizer to any Java type so long as there are no implementation conflicts. In some projects I have "jdouble[]" overloaded with math operations.