[Python-Dev] buildin vs. shared modules

Thomas Heller theller at python.net
Tue Oct 14 12:37:00 EDT 2003


"Martin v. Löwis" <martin at v.loewis.de> writes:

> Thomas Heller wrote:
>> What is the rationale to decide whether a module is builtin or an
>> extension module in core Python (I only care about Windows)?
>
> I believe it is mostly tradition, on Windows: We continue to do
> things the way they have always been done.
>
> On Linux, there is an additional rationale: small executables and
> many files are cool, so we try to have as many shared libraries as
> possible. (if you smell sarcasm - that is intentional)
>
>> To give examples, could zlib be made into a builtin module (because it's
>> useful for zipimport), _sre (because it's used by warnings), or are
>> there reasons preventing this?
>
> I think that anything that would be reasonably replaced by third parties
> (such as pyexpat.pyd) should be shared, and anything else should be part
> of pythonxy.dll.
If I look at the file sizes in the DLLs directory, it seems that at
least unicodedata.pyd, _bsddb.pyd, and _ssl.pyd would significantly grow
python23.dll. Is unicodedata.pyd used by the encoding/decoding methods?

"Tim Peters" <tim.one at comcast.net> writes:

> [Thomas Heller]
>> What is the rationale to decide whether a module is builtin or an
>> extension module in core Python (I only care about Windows)?
>
> I don't know that there is one.  Maybe to avoid chewing address space for
> code that some programs won't use.  Generally speaking, it appears some
> effort was made to make stuff an extension module on Windows if it was an
> optional part of the Unix build.  There was certainly an effort made to
> build an extension for Python modules wrapping external cod (like the _bsddb
> and _tkinter projects).
>
>> To give examples, could zlib be made into a builtin module (because
>> it's useful for zipimport), _sre (because it's used by warnings), or
>> are there reasons preventing this?
>
> zlib was there long before Python routinely made use of it; indeed, I doubt
> I ever used one byte of the zlib code outside of Python testing before zip
> import came along (and since I have no zip files to import from I guess I
> still never use it).  Leaving _sre an extension seems odd now, but at the
> time it was competing with the external-to-Python PCRE code.
>
> Why do you ask?  Answers must be accurate to 10 decimal digits <wink>.

Well, people complain about the number of files py2exe creates.  And
especially the modules used to init Python itself (in the 1.5 days,
exceptions.py, nowadays zlib.pyd) have to be special cased because they
cannot use the import hooks.

Thomas




More information about the Python-Dev mailing list