3 ms·
It uses the same Python interpreter, but each macro invocation is considered its own module. A later version of the crate will have the possibility to keep the
by m-ou-se 7y ago
It uses the same Python interpreter, but each macro invocation is considered its own module. A later version of the crate will have the possibility to keep the context around to be re-used by a later invocation such that, for example, you don't need to import things again.
- AndyMcConachie 7y agoSo this doesn't actually compile any Python, it just launches a Python interpreter when it encounters Python code? If I have many threads running Python code will it launch a new interpreter for each thread? Does it use Python 2 or 3? Thanks! I might actually use this sometime for scrap code that I'm writing to test stuff.
- m-ou-se 7y agoIt doesn't translate Python to Rust or anything like that, it uses CPython both to compile to Python bytecode and to run it. It doesn't launch a separate interpreter, the interpreter is used as a library, so runs in the same process. Python doesn't really do multithreading: https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock It uses Python 3 of course. Using Python 2 these days would be a crime.