4 ms·
I was lucky enough to find IPython early on when I started with Python. I'm constantly amazed with its feature set. Some cool things I found useful: The "run
by tdfx 14y ago
I was lucky enough to find IPython early on when I started with Python. I'm constantly amazed with its feature set. Some cool things I found useful:
The "run" command for running python scripts:
* -t to print timing information
* -p to print profiling info from profiler module
* -d run the script under pdb interactively (with -b to set line breakpoints)
* -n to set __name__
All of these things can be done fairly easily on their own, but doing it through IPython makes the output so much easier to read and work with.
Whenever I'm working with data I need to visualize, I like to use:
ipython qtconsole --pylab=inline
to get a terminal-like window that has inline graphs from matplotlib functions.
- ninetax 14y agoWhen I try to set __name__ with -n it says it's a bad flag. This is with the shell command. Is there something special I need to do?
- takluyver 14y agoYou use it inside IPython, with a command like: %run -n foo.py You can't set __name__ to arbitrary values. It's either '__main__' like when running a script, or (with -n) the module name, like when performing an import.