p.py

My p bash alias to start my hacking Python module. This is for when I'm ready to move beyond hacking directly in the interactive console, and want to start running multiple statements... but I'm still just hacking around.

p () { 
if [ -z $1 ]
then
  python p.py noconsole
else 
  python p.py console
fi
}

Then copy my p.py module into any directory where I'm hacking on some code.

p.py

# hacking around code goes up here

if __name__ == "__main__":
  import code
  import sys
  if sys.argv[1] == "console":
    code.interact(local=locals())

Then I can type p to run my commands, or p p to run the commands, and then jump into the console to work some more.