On Tue, May 10, 2022 at 8:07 PM Ben Rudiak-Gould <benrud...@gmail.com>
wrote:

> Cython seems to me rather different from what the original post was
> talking about. If I put
>
>     class Foo:
>         def bar(self):
>             pass
>
> in a .pyx file and run it through Cython, the result is a 5600-line,
> 200-kilobyte lump of C that clearly isn't meant to be understood or
> modified by human beings. It is mostly boilerplate, but not the sort of
> boilerplate that could serve as the starting point for an extension module
> written (entirely) in C.
>

Absolutely true. However, why would anyone want to hand-write an extension
module in C? Hand writing a C extension is a serious pain.

With Cython, you can either:

- Write the extension module in Cython, and with enough care, get
essentially the same thing as you would get with hand-written C
or
- Write the core logic in pure C, and then call that from Cython, then you
are hand writing the core logic (which there is a reason to do by hand in
C) and letting Cython handle all the boilerplate required to call it.

The fact that Cython generates a lot of boilerplate for a do-almost-nothing
module is an indication that there is actually a lot to be done, if you
want the general case.

What do you expect you'd get with the OP's suggestion? You might get the
basic set up code, but that's actually not the hard part of a C extension
anyway. I'm not sure it would buy you much.

-CHB

-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XC4S7FLGRCK7MYT4BLDVVFEHZFHZZFK7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to