FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-89554: Document NoneType, NotImplementedType and EllipsisType as classes by gaborbernat · Pull Request #150682 · python/cpython · GitHub

Repository navigation

gh-89554: Document NoneType, NotImplementedType and EllipsisType as classes - #150682

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
gaborbernat:gh-89554-types-singleton-class-roles
Jun 2, 2026
Merged

serhiy-storchaka merged 1 commit into
python:mainfrom
gaborbernat:gh-89554-types-singleton-class-roles

Conversation

Copy link
Copy Markdown
Contributor

types.NoneType, types.NotImplementedType, and types.EllipsisType are classes, but the documentation marks them with the .. data:: directive. This part of gh-89554 is worth a separate look: unlike the descriptor and function type objects, these three are sometimes referenced as :data:, as the type of a singleton value such as None.

This proposes switching them to .. class::, matching the other type objects in types.rst and the What's New in 3.10 entry that introduced them, which already describes them as "classes". It also updates the :data: references in Doc/library/constants.rst and Doc/whatsnew/3.10.rst to :class:.

I am happy to drop this if you would rather keep .. data:: for the singleton-value types. It is split out from the uncontroversial cases in #150676 so the decision can be made on its own.

Refs: gh-89554. Documentation-only change, so no Misc/NEWS entry (skip news).

cc @AA-Turner as the Lib/types.py maintainer.

…e as classes

NoneType, NotImplementedType and EllipsisType are classes, but were
documented with the ".. data::" directive. Unlike the other type objects
in the types module they are sometimes referenced as the type of a
singleton value, so this is proposed separately from the uncontroversial
cases.

Switch the three entries to ".. class::", matching the other type objects
and the What's New in 3.10 note that introduced them as classes, and
update the ":data:" references in constants and the 3.10 What's New page.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32924507 | 📁 Comparing 265d76d against main (2f8f569)

  🔍 Preview build  

3 files changed
± library/constants.html
± library/types.html
± whatsnew/3.10.html

picnixz commented May 31, 2026

Copy link
Copy Markdown
Member

Please,a void opening automated PRs in a bulk. I'm still not convinced by changing every occurrences mechanically.

Copy link
Copy Markdown
Contributor Author

Backward-compatibility check. This is the contested subset. The ecosystem still skews class (NoneType 231:27, NotImplementedType 43:2, EllipsisType 113:8 for py:class:py:data), but these carry the most :data: usage in the family, since they are commonly referenced as the type of the None / Ellipsis / NotImplemented singletons. They break more references than the other type-object changes, which is why they are split out for a separate decision.

picnixz commented Jun 1, 2026

Copy link
Copy Markdown
Member

For those IDK. In some sense with class, I believe autodoc will struggle less.

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. 👍

serhiy-storchaka added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Jun 2, 2026
serhiy-storchaka merged commit e40190e into python:main Jun 2, 2026
46 checks passed
github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 2, 2026

Copy link
Copy Markdown

Thanks @gaborbernat for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

bedevere-app Bot commented Jun 2, 2026

Copy link
Copy Markdown

GH-150755 is a backport of this pull request to the 3.15 branch.

bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Jun 2, 2026

bedevere-app Bot commented Jun 2, 2026

Copy link
Copy Markdown

GH-150756 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 2, 2026

bedevere-app Bot commented Jun 2, 2026

Copy link
Copy Markdown

GH-150757 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jun 2, 2026
serhiy-storchaka pushed a commit that referenced this pull request Jun 2, 2026
…pe as classes (GH-150682) (GH-150757)

Always use the directive and the role "class" instead of "data" for
NoneType, NotImplementedType and EllipsisType.
(cherry picked from commit e40190e)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
serhiy-storchaka pushed a commit that referenced this pull request Jun 2, 2026
…pe as classes (GH-150682) (GH-150756)

Always use the directive and the role "class" instead of "data" for
NoneType, NotImplementedType and EllipsisType.
(cherry picked from commit e40190e)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
serhiy-storchaka pushed a commit that referenced this pull request Jun 2, 2026
…pe as classes (GH-150682) (GH-150755)

Always use the directive and the role "class" instead of "data" for
NoneType, NotImplementedType and EllipsisType.
(cherry picked from commit e40190e)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
gaborbernat deleted the gh-89554-types-singleton-class-roles branch October 3, 2026 15:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL