There's another "major" problem with theading.local()-like API for PEP 550: C API.
threading.local() in C right now is PyThreadState_GetDict(), which returns a dictionary for the current thread, that can be queried/modified with PyDict_* functions. For PEP 550 this would not work. The advantage of the current ContextKey solution is that the Python API and C API are essentially the same: [1] Another advantage, is that ContextKey implements a better caching, because it can have only one value cached in it, see [2] for details. [1] https://www.python.org/dev/peps/pep-0550/#new-apis [2] https://www.python.org/dev/peps/pep-0550/#contextkey-get-cache Yury _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/