Am 31.01.2010 07:29, schrieb Nick Coghlan:
> 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.
>>, 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.pyr/
>   cpython-25.pyc
>   cpython-25U.pyc
>   cpython-27.pyc
>   cpython-27U.pyc
>   cpython-32.pyc
>   unladen-011.pyc
>   wpython-11.pyc

+1.  It should be quite easy to assign a new name every time the magic
number is updated.

> If we don't change the bytecode for a given Python version, then the
> name of the bytecode format used wouldn't change either.

That would be the only remaining complaint for casual users. ("Why doesn't
Python compile my file for 2.8?")


Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

Python-Dev mailing list

Reply via email to