Defining a Python enum in a C extension - am I doing this right?

Dan Stromberg drsalists at gmail.com
Sat Jul 24 00:55:34 EDT 2021


On Fri, Jul 23, 2021 at 1:20 AM Bartosz Golaszewski <brgl at bgdev.pl> wrote:

> Hi!
>
> I'm working on a Python C extension and I would like to expose a
> custom enum (as in: a class inheriting from enum.Enum) that would be
> entirely defined in C.
>

I'm probably missing something obvious, but why would you write new code in
C when you can just use Cython?  Cython is a lot easier, and quite fast,
and should (eventually?) allow compiling to HPY instead of just "the" C
extension module interface.

https://news.ycombinator.com/item?id=26627683


More information about the Python-list mailing list