Title: Deprecate the and pseudo-modules
Type: behavior Stage: patch review
Components: Documentation, Library (Lib) Versions: Python 3.11
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Jelle Zijlstra, dgelessus, docs@python, gvanrossum, levkivskyi, srittau
Priority: normal Keywords: patch

Created on 2019-09-27 11:48 by dgelessus, last changed 2021-05-13 21:54 by srittau.

Pull Requests
URL Status Linked Edit
PR 26113 open srittau, 2021-05-13 21:53
Messages (5)
msg353356 - (view) Author: (dgelessus) * Date: 2019-09-27 11:48
According to bpo-35089 (and the GitHub issues linked there), the and modules should no longer be used. Starting with Python 3.6, the typing documentation no longer mentions the and modules, and instead documents their contents as part of the main typing module.

However, the typing module at runtime still supports and as before. Since these modules are not meant to be used anymore and are no longer documented, I would expect at least a DeprecationWarning when using them at runtime.

The documentation on this could also be a bit clearer. As long as the modules are still supported at runtime, I would expect the documentation to mention that they still exist, but shouldn't be used anymore. In its current state, the documentation is confusing when coming from Python 3.5 (where and were the only documented way to access IO, Pattern, etc., but accessing typing.IO and typing.Pattern directly also works at runtime).
msg353400 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2019-09-27 20:09
Guido, what is your final opinion on this?
msg392730 - (view) Author: Jelle Zijlstra (Jelle Zijlstra) * (Python triager) Date: 2021-05-02 20:39
The documentation ( now mentions the and namespaces.

I would prefer that they be deprecated and eventually completely removed. They don't work with most static type checkers. makes the same points.
msg393611 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-05-13 21:37
I agree, these namespaces were a mistake. Let's start deprecating them (and remove their mention from the docs again).
msg393613 - (view) Author: Sebastian Rittau (srittau) * Date: 2021-05-13 21:54
I opened a PR to remove their mention from the docs for now. I can look into how to add a deprecation warning to a module if no one else beats me to it.
Date User Action Args
2021-05-13 21:54:30srittausetmessages: + msg393613
2021-05-13 21:53:18srittausetkeywords: + patch
stage: patch review
pull_requests: + pull_request24757
2021-05-13 21:37:39gvanrossumsetmessages: + msg393611
versions: - Python 3.10
2021-05-03 10:28:51srittausetnosy: + srittau
2021-05-02 20:39:57Jelle Zijlstrasetnosy: + Jelle Zijlstra
title: Unclear status of the and pseudo-modules in docs and runtime -> Deprecate the and pseudo-modules
messages: + msg392730

versions: + Python 3.10, Python 3.11, - Python 3.6, Python 3.7, Python 3.8, Python 3.9
2019-09-27 20:09:08levkivskyisetnosy: + gvanrossum, levkivskyi
messages: + msg353400
2019-09-27 11:48:37dgelessuscreate