Description
Currently, several sections of the documentation contain code snippets that employ legacy Python 2 syntax or outdated usage patterns. To maintain the high quality of official resources, these should be modernized to align with current standards.
Motivation
Modernizing these examples prevents confusion for new learners and ensures the documentation reflects the idiomatic standards of Python 3.10+.
Linked PRs
Description
Currently, several sections of the documentation contain code snippets that employ legacy Python 2 syntax or outdated usage patterns. To maintain the high quality of official resources, these should be modernized to align with current standards.
Motivation
Modernizing these examples prevents confusion for new learners and ensures the documentation reflects the idiomatic standards of Python 3.10+.
Linked PRs
Doc/tutorial/stdlib2.rst#149036To contributors: we definitely don't want code churn, so PRs targetting this issue should limit their scope to a well-defined part of the stdlib's docs and avoid spreading across multiple modules. And for whoever uses an LLM, read https://devguide.python.org/getting-started/generative-ai/.