[Python-Dev] PEP 3147

Barry Warsaw barry at python.org
Sat Apr 10 17:51:22 CEST 2010


On Apr 09, 2010, at 11:05 PM, Antoine Pitrou wrote:

>« Instead, this PEP proposes to add a mapping between internal magic numbers 
>and a user-friendly tag. Newer versions of Python can add to this mapping so 
>that all later Pythons know the mapping between tags and magic numbers. »
>
>The question is: why do we have to keep a mapping of past tags and magic
>numbers? Don't we only care about our current tag and magic number?
>(similarly, we don't know, and need to know, about Jython's or Pypy's
>stuff...).
>
>As far as I can tell, it would remove the burden of maintening an ever-growing
>registry of past magic numbers and tags.

If you look at the comment near the top of import.c, we kind of do anyway, we
just don't make it available to Python. ;)

I don't have strong feelings about this.  I thought it would be handy for
future Python's to have access to this, but then, without access to previous
version magic numbers, it probably doesn't help much.  And as you say, CPython
won't know about alternative implementation's tags.

So I'm willing to call YAGNI on it and just expose the current Python's magic
tag.  While we're at it, how about making both the tag and the number
attributes of the imp module, instead of functions like .get_magic()?  Of
course we'd keep the latter for backward compatibility.

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100410/645ebbf8/attachment.pgp>


More information about the Python-Dev mailing list