3 ms·
I was going to make a similar comment about reload() in Python. One dev technique out of the many available is to have your code being edited in your editor whi
by sitkack 5y ago
I was going to make a similar comment about reload() in Python. One dev technique out of the many available is to have your code being edited in your editor while in another terminal window, using an ipython repl to drive it. Currently one would need to `from importlib import reload` and of course ipython itself has
https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html?highlight=autoreload#autoreload https://ipython.readthedocs.io/en/stable/config/extensions/a...
Launch ipython like you would `pdb`
https://pypi.org/project/ipdb/ https://pypi.org/project/ipdb/
*edit to @dwohnitmok as the author of Crafting Interpreters mentioned, it really works pretty well in practice. And for cases where I was changing enough state that it bails out, you can either set a breakpoint in a test or create a little closure to build up the right state and then pass back an fn to step through in ipython.
Infact, this dev style reinforces an immutable nearly functional data centric programming model. With that model, changes to code won't impact the data, so reloads are actually rare. Have shallow reference chains, use value types in simple containers and lots of problems kinda melt away.
Ha! https://news.ycombinator.com/item?id=29965226 https://news.ycombinator.com/item?id=29965226 the highest rank post on Google search for that quote is less than 3 days old. Know we know why results are so bad!
- dwohnitmok 5y agoFascinating. So the main thing I'm curious about is the exact mechanics of this: > And for cases where I was changing enough state that it bails out What exactly does "bailing out" entail?
- sitkack 5y agoIt isn't something I explored that deeply. When a reload fails, you know about it and you just reload the program and continue. It could manifest itself in lots of ways, any of which I don't have off the to of my head.
- deleted 5y ago[deleted]