running python 2 vs 3

Chris Angelico rosuav at gmail.com
Thu Mar 20 13:29:54 EDT 2014


On Fri, Mar 21, 2014 at 4:23 AM, notbob <notbob at nothome.com> wrote:
> On 2014-03-20, Mark H Harris <harrismh777 at gmail.com> wrote:
>
>> not) there really is no problem. The reason is that the .pyc files
>> created for python2.x are only used by python2.
>
> Lordy, what hath I wrought!?  ;)
>
> What the heck is a .pyc file and how are they created?  Actually, I
> can see  it's a compiled binary, but I where did it come from?
>
> I went back to my ~/python/ dir and noticed one .pyc file out of 15
> .py files I created from following Learning Python the Hard Way.  No
> one said anything about creating a binary.  I know I discovered how to
> create/edit python scripts from IDLE.  Is that it?  I've been using
> gedit and emacs up till now.  Seems the file with the .pyc file is the
> one I edited in IDLE.  Is that why LPtHW eschews IDLE for gedit?
>
> Why do I feel like I've really stepped in it?  ;)
>

You should be able to completely ignore .pyc files, most of the time.
The only thing to remember is that you should delete them any time you
delete the corresponding .py files. They're a cached version that
Python will use to speed up imports, nothing more.

Nowadays they'll be pushed away into a separate directory, which makes
them easier for you to ignore. This is a good thing.

ChrisA



More information about the Python-list mailing list