Hacker News new | ask | show | jobs
by smittywerben 2687 days ago
This is pretty smart. When I'm making one-off scripts I use the interactive flag

python -i script.py

I've programmed Python for years and never knew this. I'm not sure how well this handles errors. Tab complete works, only thing that is missing is needing to wrap help(<func>) to see signatures. I'm enjoying the standard lib interpreter.

1 comments

I use ipython for similar task. It has wrapper for 'help' function ('?' symbol after function name), tab completion and syntax highlighting. Also it has special %hist command for easy copy-paste code.
I like IPython unless working with large arrays, because of weird memory issues I experienced (maybe they're fixed?). I miss the %run, !<cd, ls, pip>, %timeit magic and the IPython.terminal.debugger.set_trace().

If you're on linux it's not _that_ bad without it since the shell sort of acts like the notebook (with an equally horrible markup language). The help() and tab-complete and _ __ ___ for last 3 values works, time python <file>.py can benchmark, -i or pdb.set_trace does the debugging. It doesn't keep a persistent history though so the workflow is sort of different.

So I use both, particularly for plots and images knowing IPython is very helpful for working with the notebooks.