[Python-Dev] importing .pyc-files generated by Python 1.5.2 in Python 1.6. Why not?

Greg Stein gstein@lyra.org
Wed, 24 May 2000 14:58:48 -0700 (PDT)


On Wed, 24 May 2000, Eric S. Raymond wrote:
> Peter Funk <pf@artcom-gmbh.de>:
> > BTW: import.c contains the  following comment:
> > /* XXX Perhaps the magic number should be frozen and a version field
> >    added to the .pyc file header? */
> > 
> > Judging from my decade long experience with exotic image and CAD data 
> > formats I think this is always the way to go for binary data files.  
> > Using this method newer versions of a program can always recognize
> > the file format version and convert files generated by older versions
> > in an appropriate way.
> 
> I have similar experience, notably with hacking graphics file formats.
> I concur with this recommendation.

One more +1 here.

In another thread (right now, actually), I'm discussing how you can hook
up Linux to recognize .pyc files and directly execute them with the Python
interpreter (e.g. no need for #!/usr/bin/env python at the head of the
file). But if that magic number keeps changing, then it makes it a bit
harder to set this up.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/