4 ms·
In Python, thread-local variables and ContextVars get you quite a bit of the way there. You can even implement “without” patterns, albeit only as runtime check
by btown 3y ago
In Python, thread-local variables and ContextVars get you quite a bit of the way there.
You can even implement “without” patterns, albeit only as runtime checks - though if you’re following the React practice that hooks must be called unconditionally, and you have test coverage, you essentially have compile time checks.
And, speaking of coloring problems, if you’re running on gevent, both become greenlet-local, and you can benefit from concurrency limited only by working memory, without needing explicit async code.
- __s 3y agocontextvar looks nice, maybe something with Python's `with` syntax could work