"R.Wieser" writes:
>> newfunc PyTypeObject.tp_new
>>
>> An optional pointer to an instance creation function.
>
> That part I understood (from the fields name).
>
> My doubt was/is if the current way its done would perhaps result in a
> (sort of) singleton, and moving the "PyType_GenericNew" reference into
> the table itself would possibly cause multiple instances to be
> created.
Both strategies still have the same behavior. The choice of assignment vs
initialisation does not make any difference here. It certainly isn’t
going to cause the function to be called different numbers of times at
some point in the future; if you think that it is then you need to
revisit your mental model of what is going on here.
--
https://www.greenend.org.uk/rjk/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|