How to install Python package from source on Windows

Chris Angelico rosuav at gmail.com
Tue May 16 10:29:53 EDT 2017


On Tue, May 16, 2017 at 11:41 PM, bartc <bc at freeuk.com> wrote:
>> Are you suggesting that a C compiler should be written in Python?
>> Because you're dealing with an extension library. It's not written in
>> pure Python. That's why it needs a C compiler. While it is certainly
>> possible to write a C compiler in Python, it is unlikely to outperform
>> the existing popular compilers (gcc, clang, msvc, etc), which have had
>> many years of expertise poured into them.
>
>
> In what way, compilation speed, or speed of the generated code?

I'm talking mainly about the speed of the generated code, but the two
are somewhat linked. A slow compiler that produces amazing code will
take three parts of forever to complete, so if your code is slow,
you'll turn off some of the optimizations so it finishes sooner, which
means you get worse output.

It's possible that you could write a C compiler in Python that emits
something that back-ends into a machine code generator, but that just
moves the problem around ("why do we need this codegen?"). To build a
high quality C compiler *purely* in Python means knowing about every
CPU architecture that you can target. That's a daunting job if you
aren't going to piggy-back on something that already exists.

ChrisA



More information about the Python-list mailing list