"R.Wieser" writes:
> To clarify:
>
>>>> PWM_init_PWMType sets up the type (someting that doesn't need
>>>> to know about any module it may end up in),
>
> That sounds quite logical.
>
>>>> PyModule_AddObject gives the type a name in a module.
>
> That commands last argument reaches into the PWM module, which goes
> against what you mentioned above, and which is what I tried to refer
> to: The main module should also not need to know anything about the
> PWM one, but for how to call its class initialisator - which, I could
> imagine, might have a strictly defined name.
The relevant module is RPi._GPIO. That’s what PyInit__GPIO is setting
up. PyModule_AddObject gives the type defined in C by PWMType the name
“PWM” in that module. If you don’t believe me then consult the Python C
API documentation. RPi._GPIO only “knows” about its own module
namespace, it doesn’t know about the internals of PWMType, so it seems
to me that your preferences about who knows what are already met.
--
https://www.greenend.org.uk/rjk/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|