[Python-Dev] [Python-checkins] r45925 - in python/trunk: Lib/tempfile.py Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c
"Martin v. Löwis"
martin at v.loewis.de
Tue May 16 07:34:15 CEST 2006
M.-A. Lemburg wrote:
> Well, the strings and integers count twice: once in the module
> namespace and once in the errorcode dictionary.
That shouldn't be the case: the strings are interned (as they
are identifier-like), so you have the very same string object
in both dictionaries.
The numbers shouldn't be duplicated because they occur
in the co_consts array of the global code object, and because
the compiler should share them there.
> Given that the code strings and integers are created
> twice in my version of the module, the numbers sound about
> right.
If they are indeed created twice, something is wrong.
> I agree that creating only one dictionary statically
> and the other mapping dynamically will already be a
> saving of 50% simply by sharing the string and integer
> objects.
No, they should be shared already, so that shouldn't save
anything.
Regards,
Martin
More information about the Python-Dev
mailing list