v0.5.0
PythonMonkey v0.5.0
- fixed a bug where
pmjs -e
/pmjs -p
was not able to call functions that require the event loop - implemented setInterval and clearInterval
- implemented further cross-language support for iterators (more widespread use of iterators, such as the for-of loop for arrays, was already working in previous versions)
using a JS iterator in python:
import pythonmonkey as pm
myit = pm.eval('(function* () { yield 1; yield 2; })')()
print(next(myit)) # 1.0
print(next(myit)) # 2.0
print(next(myit)) # StopIteration exception
using a python iterator in JS:
import pythonmonkey as pm
myit = iter((1,2))
pm.eval("""
(myit) => {
console.log([...myit]); // [1, 2]
}
""")(myit)