Re: PEP 489: Multi-phase extension module initialization; version 5
Petr Viktorin <[email protected]> Mon, 18 May 2015 18:27:50 +0200
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CA+=+wqCs1m7GwiDcbmTAgKSM2qLq-+piJndPU9Sd-FVRO-Fbww@mail.gmail.com> |
On Mon, May 18, 2015 at 5:58 PM, Antoine Pitrou <[email protected]> wrote: > On Mon, 18 May 2015 17:32:13 +0200 > Petr Viktorin <[email protected]> wrote: >> >> > A fast, easy way to access module "state" without defining global >> > variables at the C level is required. >> >> You can have a custom subclass, or you can use per-module state, or >> put a capsule in the module dict. > > The latter two are cumbersome and inefficient. Only custom subclasses > can make things easy and fast at the C level. With per-module state, you need a one-liner macro, and a pointer dereference at runtime. Is that too cumbersome and inefficient, or am I missing something? The PEP still supports custom subclasses, for cases where you need easy and fast module state. > Which is why I'm surprised that you seem to be encouraging, or not > discouraging, the "module state" API. No, I'm not discouraging it. The PEP makes sure it continues to work. Should there be another PEP to deprecate it?