Yury Selivanov wrote:
> On Thu, Jun 6, 2019 at 5:20 PM Christoph Groth <christ...@grothesque.org> 
> wrote:
> [..]
> > The other possibility I see would be wrapping ContextVar inside a
> > class (like in the example module that I attached to the first post
> > in this thread), but that's not a good solution.  It requires
> > replicating the complete API, and is hence slow and not
> > forward-compatible.
>
> Wrapping isn't much slower than subclassing and calling super().
> (...)

What is actually the reason that Py_TPFLAGS_BASETYPE is not set for
ContextVar (and many other built-in types)?  The performance penality
cannot be significant since both tuple and list are subclassable.  Does
it complicate the implementation?  The requirements [1] do not look bad.
Am I missing anything obvious here?

(The extension types that I wrote are also not subclassable, but I just
followed the default here and so far no one complained.)

[1] https://www.python.org/dev/peps/pep-0253/#preparing-a-type-for-subtyping
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MRVOLJVSK5D3KNW373UDGIF3H4DI3UAF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to