We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d9b73c commit 1ced829Copy full SHA for 1ced829
doc/INTEROP.md
@@ -49,6 +49,19 @@ def python_method():
49
return "Hello from Python!"
50
```
51
52
+Finally, to interoperate with Java (only when running on the JVM), you can use
53
+the `java` module:
54
+```python
55
+import java
56
+BigInteger = java.type("java.math.BigInteger")
57
+myBigInt = BigInteger(42)
58
+myBigInt.shiftLeft(128) # public Java methods can just be called
59
+myBigInt["not"]() # Java method names that are keywords in
60
+ # Python can be accessed using "[]"
61
+byteArray = myBigInt.toByteArray()
62
+print(list(byteArray)) # Java arrays can act like Python lists
63
+```
64
+
65
#### Python responses to Truffle interop messages
66
67
###### READ
0 commit comments