Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If God is perfect, why did He create discontinuous functions?


devel / comp.lang.python / Re: Defining a Python enum in a C extension - am I doing this right?

SubjectAuthor
o Re: Defining a Python enum in a C extension - am I doing this right?Dan Stromberg

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

<mailman.255.1627102548.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14279&group=comp.lang.python#14279

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: drsali...@gmail.com (Dan Stromberg)
Newsgroups: comp.lang.python
Subject: Re: Defining a Python enum in a C extension - am I doing this right?
Date: Fri, 23 Jul 2021 21:55:34 -0700
Lines: 15
Message-ID: <mailman.255.1627102548.4164.python-list@python.org>
References: <CAMRc=MehhhAGOt=u3qpYzHRhgqpeStew30qiLRNoA5mScgf=PA@mail.gmail.com>
<CAGGBd_okHs_6Norrd2D6zctFm0XYfBL1q5ohr4JvkigHWXX5Ew@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de z0RZHSxIp1Rpvw6mQQM38wT0dm5lHbjFnwFmMNZ3kdfQ==
Return-Path: <drsalists@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=nKu/bsjk;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'jul': 0.04; 'cc:addr
:python-list': 0.09; 'subject:Python': 0.12; '"the"': 0.16;
'cc:name:python': 0.16; 'expose': 0.16; 'fast,': 0.16;
'from:addr:drsalists': 0.16; 'from:name:dan stromberg': 0.16;
'received:209.85.217': 0.16; 'subject:extension': 0.16; 'wrote:':
0.16; 'python': 0.16; 'instead': 0.17; 'cc:addr:python.org': 0.19;
'fri,': 0.23; 'extension': 0.24; 'code': 0.24; 'probably': 0.24;
'cc:2**0': 0.27; '(as': 0.27; 'module': 0.28; 'but': 0.31; "i'm":
0.32; '23,': 0.32; 'message-id:@mail.gmail.com': 0.33; 'class':
0.33; 'header:In-Reply-To:1': 0.33; 'received:google.com': 0.34;
'missing': 0.35; 'from:addr:gmail.com': 0.35; 'received:209.85':
0.38; 'something': 0.38; 'received:209': 0.38; 'use': 0.38; 'lot':
0.62; 'subject:this': 0.63; '2021': 0.84; 'bartosz': 0.84;
'easier,': 0.84; 'url:news': 0.93; 'url-ip:209/8': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=KBWJPIQYNjkaB5DfdpnmAKMwYT/vlD8A/cX5tb5e+qM=;
b=nKu/bsjkEhVCz5JPOrN/IWMfw9gTClGF+dz93dXEJE1xqnQDOMx3ziM1auxL7KhcEJ
cOppqM+3mh/Xx2coyhIPx+3f0+C7Y2nwts05vKmWvqVYDAegkzs4a85tmXzyC21TzEfS
MoLcHqjGyWcpg9TLnLqaOWddyP4qyoMvSFkQKLdYUGWkUGY+y1J0+EUX80StEDU5NWD7
TXNhBhjy+v0so7AyYELPsocQyZtcpsjQGkEhJ7E3BDw5QRS/hKq2iUPU9hf8/ZWOvijk
ASmUL2grffgUuvKRX3m6C6XHnp8mnG7J++KB4KO4UYtXk13iVL2ylH3BaYaz9G0W/eiU
raSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=KBWJPIQYNjkaB5DfdpnmAKMwYT/vlD8A/cX5tb5e+qM=;
b=gcVH69gMjRDeSeOGK+y6AYR8T7Cy0w+u5X1tvk9GKRh6rLWFeQVzZnvBP/3rXaL/3A
jPPfwO5e4oHsUGHFdvl35Vsi09I76KPfeHooaN56/4Y4qlYn9ILjmU8nnUTC1zRqn6Ww
B4B8jEiplGL17zXPjT5/8QwQtO40faEQD9uznI+ETotdZKvuX4bLhgXbMrgdoexTKH5r
Pfl1d75BgCCEEDflZsWAc5JI+91ilA8ylqBboEh3AgBi1X3HJ6149dQYO7bBr0qHNzqR
35rzWmzzvh7aQsxnndt/xb3rtsdIFBmffDj7f5cO2SNsV1ChBx25vJ5sClgKv1Hi3me8
NZxQ==
X-Gm-Message-State: AOAM5320Dj3blfbLxFvajQgV92ub++bJnxbMCIJtZyYU2Ns7UGf4Lyct
ooVgeJbIVr82UXRtADV5H3/VeVsWRgd+V0/QSdjlLYvmuQo=
X-Google-Smtp-Source: ABdhPJzy/vwZRyyzeV72tF5DOYgcagX/0/CcubRwoNIY9DzoFEkHTJ+GL3z7dicXu4qPRI/vi1KxutDf+zW6rkOOVQc=
X-Received: by 2002:a67:310a:: with SMTP id x10mr7350469vsx.30.1627102546232;
Fri, 23 Jul 2021 21:55:46 -0700 (PDT)
In-Reply-To: <CAMRc=MehhhAGOt=u3qpYzHRhgqpeStew30qiLRNoA5mScgf=PA@mail.gmail.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAGGBd_okHs_6Norrd2D6zctFm0XYfBL1q5ohr4JvkigHWXX5Ew@mail.gmail.com>
X-Mailman-Original-References: <CAMRc=MehhhAGOt=u3qpYzHRhgqpeStew30qiLRNoA5mScgf=PA@mail.gmail.com>
 by: Dan Stromberg - Sat, 24 Jul 2021 04:55 UTC

On Fri, Jul 23, 2021 at 1:20 AM Bartosz Golaszewski <brgl@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

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor