I maintain a huge workflowy file of snippets and tricks and, I suspect some of them will be handy for others to use too. I’m going to sharing them regularly, when I’m not sure what to write, mainly to keep the habit of blogging, until it comes naturally.
Part of my professional life, involves me writing a fair amount of python code. When you write python, you end up creating lots of files ending with
.py, but when you run the code, you end up with compiled python files, sending in
If you don’t want loads of
pyc files crufting up your workspace, and you’re workignon the command line, there’s a handy little environment variable you can set in your shell, to banish those ugly files once and for good. Run this command before working (or better yet, make it run whenever you open a terminal window):
See, isn’t that better?
I picked up this gem from the Hitchhiker’s Guide to Python, a free, opinionated book from Kenneth Reitz about good practices with working with Python. Reading it will almost certainly improve your python – I know mine is better as a result of spending some looking over it.