Message12086
Glad I was able to guess right.
The use of library modules has the same point as ever: you get to write the code once and use it from lots of places. This statement in the openHAB Jython scripting guide, however, is incorrect (from 2.7.1) in the third paragraph: https://github.com/OH-Jython-Scripters/openhab2-jython#jython-scripts-and-modules .
That was true up to 2.7.0, but that was a defect. If you compare it with what PEP-554 has to say: https://www.python.org/dev/peps/pep-0554/#interpreter-isolation you'll see what I mean. PEP-554 is comparatively recent, and is really about exposing the facility for multiple interpreters in a new stdlib module. For that, it documents how interpreters have worked for a long time at the C-level.
It looks very much like openHAB intends each script to execute in a fresh context, and now that context is unpolluted by modules (and their state) loaded by other scripts. It's slower, of course. OpenHAB could make this configurable by allowing you to choose to re-use the script engine (or script context?), which would mean the same modules, loaded once. |
|
Date |
User |
Action |
Args |
2018-08-14 20:01:13 | jeff.allen | set | messageid: <1534276873.02.0.56676864532.issue2700@psf.upfronthosting.co.za> |
2018-08-14 20:01:13 | jeff.allen | set | recipients:
+ jeff.allen, stefan.richthofer, spaceman_spiff |
2018-08-14 20:01:12 | jeff.allen | link | issue2700 messages |
2018-08-14 20:01:11 | jeff.allen | create | |
|