Bytecode files are created by the interpreter the first time the code is run, so that (among other things) it will run faster with subsequent running. The only reason you should remove them is if you've changed the code in one of the corresponding .py
files, and for some reason the interpreter is not picking up the changes (possibly due to an issue with the timestamp). Additionally, you can also get rid of them if you change versions of Python (for example, from 2 to 3, or from 2.6 to 2.7). Changing micro versions (such as 2.7.3 to 2.7.9) won't affect the bytecode structure, so a small upgrade such as that is harmless. And, as sapi points out, if you want to delete a .py
file for some reason, you should also delete the corresponding .pyc
as well.
From mgilson, see this blog post from Ned Batchelder on the structure and function of .pyc
files.