Porting the 2-3 heap data-structure library from C to Python

Stefan Behnel stefan_ml at behnel.de
Sun Mar 11 08:41:17 CET 2012


Hrvoje Niksic, 11.03.2012 02:03:
> Stefan Behnel writes:
>>> which is the standard way of extending Python with high-performance
>>> (and/or system-specific) C code.
>>
>> Well, it's *one* way.  Certainly not the easiest way, neither the most
>> portable and you'll have a hard time making it the fastest.
> 
> I didn't say it was easy, but standard, in the sense of documented in
> Python documentation.  Python/C is as portable as Python itself, and as
> fast as the platform allows.

Only if you know how to do it right and have the discipline to do a lot of
cross-platform testing, benchmarking and tuning. Not everyone wants to
invest that much time into details that are unrelated to the problem at
hand. And why should they, when other people (who have gained some
experience in it) have already done if for them and continue to do that, so
that they don't need to care and can get it for free?


> I understand your desire to promote
> Cython, but please stop resorting to FUD in doing so.

I can't see it being FUD (although arguably promotion) to tell people that
"we write C so you don't have to". It's certainly not FUD that it's easier
(and IMHO also more fun) to write good Python code than good C code. Quite
the contrary, telling new users to go straight for writing C code and using
CPython's C-API natively is like asking them why (the heck!) they are using
Python in the first place, when they can just dive into the beautiful world
of C. I don't think that's the ideal attitude for this list.

Stefan




More information about the Python-list mailing list