Vitor Bosshard wrote: >> There is no one-to-one correspondence between Python version and pyc >> magic numbers. Different runtime options may change the magic number and >> different versions may reuse a magic number > > Good point. Runtime options would need to change the version (e.g. > foo.25U.py), and versions that reuse magic numbers would be > redundantly written to disk. However, the underlying issue as I see it > is that the magic value is an implementation detail that should not be > exposed.
I think this is actually be a good point - while there needs to be a shared namespace to allow different Python implementations to avoid stepping on each others toes, CPython's bytecode compatibility magic number may not be the best choice as the distinguishing identifier. It may be better to give the magic numbers a meaningful corresponding string, such that the filenames would be more like: foo.py foo.pyr/ cpython-25.pyc cpython-25U.pyc cpython-27.pyc cpython-27U.pyc cpython-32.pyc unladen-011.pyc wpython-11.pyc If we don't change the bytecode for a given Python version, then the name of the bytecode format used wouldn't change either. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com