Documenting collections.abc __class_getitem__ type hints
I'm looking through the documentation, and not finding any good reference for type hints for __class_getitem__ in the collections.abc module. I do see some of it covered in the typing module documentation, but those are deprecated, and some are somewhat cryptic (e.g. Coroutine). Make sense to open a BPO and start a PR for doc updates? Paul
Hello, Paul. The docs for __class_getitem__ are here: https://docs.python.org/3/reference/datamodel.html#emulating-generic-types I think the Data Model chapter is the right place for it. Cheers, Luciano On Thu, May 6, 2021 at 2:14 AM Paul Bryan <pbryan@anode.ca> wrote:
I'm looking through the documentation, and not finding any good reference for type hints for __class_getitem__ in the collections.abc module.
I do see some of it covered in the typing module documentation, but those are deprecated, and some are somewhat cryptic (e.g. Coroutine).
Make sense to open a BPO and start a PR for doc updates?
Paul
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/U3QIWBXH... Code of Conduct: http://python.org/psf/codeofconduct/
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg
I should have probably written my message more clearly. I'm referring to the specific expected parameters for generic types, especially those in collections.abc (e.g. Callable, Coroutine, ...). Each expects different parameters depending on its type. Other examples, where are the (non-deprecated) generic type signatures for dict, list, etc. defined? Data model seems appropriate for covering how to expose generic types, but the type-specific signatures should be defined closer to there types? Paul On Thu, 2021-05-06 at 11:10 -0300, Luciano Ramalho wrote:
Hello, Paul.
The docs for __class_getitem__ are here:
https://docs.python.org/3/reference/datamodel.html#emulating-generic-types
I think the Data Model chapter is the right place for it.
Cheers,
Luciano
On Thu, May 6, 2021 at 2:14 AM Paul Bryan <pbryan@anode.ca> wrote:
I'm looking through the documentation, and not finding any good reference for type hints for __class_getitem__ in the collections.abc module.
I do see some of it covered in the typing module documentation, but those are deprecated, and some are somewhat cryptic (e.g. Coroutine).
Make sense to open a BPO and start a PR for doc updates?
Paul
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/U3QIWBXH... Code of Conduct: http://python.org/psf/codeofconduct/
participants (2)
-
Luciano Ramalho
-
Paul Bryan