Re:Neuron, a new VS Code extension for data science
by mirashii on Thursday November 01, 2018 @12:17PM
(#18355502)
You can actually do this as a context manager, I have done something very similar in the past. I created a dummy context manager with a unique name and used an importhook to do an AST rewrite to the body of the context manager. It's a bit of a hack (okay, a lot of a hack), but allows for some really neat patterns that context managers didn't allow.
(Yes yes write documents export LaTeX. Not sure people care about this at all)
I've been developing a style where development "cells" are cached with joblib.Memory so re-running a script from command line doesn't take idiotic amounts of time. Further, I have litte context managers such that
exports a file that immediately shows in the folder navigation bar of Atom. It's overall a better experience.What I would really like is being able to use joblib.Memory not as a decorator (which requires bunching up your "cells" in functions and calling them separately) but as a context manager.
---
To the tune of the "Portlandia" song: the dream of MUMPS state is alive in joblib...