Python MSVC++ binaries considered evil

John Machin sjmachin at lexicon.net
Wed Jan 23 02:45:56 EST 2002


joost_jacob at hotmail.com (J.Jacob) wrote in message news:<13285ea2.0201221557.3421dfd3 at posting.google.com>...
> One of the beauties of Python is that you can extend it with C modules.
> Recode your bottlenecks in C and you program can have the speed of programs
> written completely in C.
> 
> Unfortunately this is not true when you have a Windows operating system and
> you have Python installed from binaries.You will need the Microsoft Visual C++ 6.0 compiler.

False. You can make DLLs using the Borland or MinGW compiler.

>  That compiler is expensive and has licence issues.

Certainly one needs to pay money for the standard retail version.
Whether it is value for money, I can't say, as I've never used it.
There is a "free" version available as part of the absolutely
humungous .NET beta SDK; however it doesn't support code optimisation,
and when I tried to build a module with it, it failed, grumbling it
couldn't find I_forget_which.h :-(

>  Since most Python installations are from Windows binaries this effectively ties
> Python to Microsoft.

[snipped: more erroneous conclusions based on false premises]

It is not necessary to be able to (re-)compile Python to be able to
extend it, not on Windows certainly, and not on any operating system
that supports dynamically loading code, as most (all?) flavours of *x
do. On Windows, while the Python .exe is compiled using the MS
compiler, it is quite possible and relatively easy to extend Python by
making DLLs using either the Borland or MinGW compiler. These are
"free" in the sense that you pay no money (except maybe to your ISP
for the download).

Using is "relatively easy": use the almost magical and
highly-recommended distutils ...

   command_prompt> python setup.py build --compiler=bcpp

   command_prompt> python setup.py build --compiler=mingw32

You can even have both (examine warning/error messages from each, see
which one generates faster modules, ...)

Initial set-up is a bit of a PITA, though; you have to make your own
lib for each compiler --- HINT HINT HINT --- please O great Timbot
slip these two goodies into the installer for future Python releases.

BTW, there *is* documentation (in the Python manuals!) for extending
Python with the non-MS compilers on Windows ...



More information about the Python-list mailing list