Skip to content

v0.5.0

Compare
Choose a tag to compare
@zollqir zollqir released this 15 Apr 19:24
· 763 commits to main since this release
c9bec0f

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)