I am developing a Python package using a text editor and IPython. Every time I change any module code, I have to restart the interpreter to check this. This is a pain because the classes I'm developing rely on a context that needs to be restored with every reboot.
I know about the reload() function, but it looks like a frown (also since it was diverted from the built-in Python 3.0) and, moreover, it rarely works, since modules almost always have multiple references.
My question is: what is the best / generally accepted way to develop a Python module / package so that I don't have to feel the pain of constantly restoring my interpreter context?
One idea that I thought of was to use the if __name__ == '__main__': trick if __name__ == '__main__': to run the module directly, so the code is not imported. However, this leaves a bunch of contextual cracks (specific to my installation) at the bottom of my module files.
Ideas?
python module packages
Brendan
source share