Skip to content

gh-161007: Add a glossary entry for "virtual subclass" - #161182

Open
thejesh23 wants to merge 3 commits into
python:mainfrom
thejesh23:glossary-virtual-subclass
Open

thejesh23 wants to merge 3 commits into
python:mainfrom
thejesh23:glossary-virtual-subclass

Conversation

@thejesh23

@thejesh23 thejesh23 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

The "abstract base class" glossary entry mentions virtual subclasses but the
term had no entry of its own. This adds a short virtual subclass entry
(between "virtual machine" and "walrus operator") that explains:

  • issubclass() and isinstance() treat a virtual subclass as a subclass of an
    ABC, even though it does not inherit from the ABC;
  • a class is made one by ABCMeta.register(); an ABC can also recognize
    classes without registration via __subclasshook__();
  • the ABC is not in its MRO, and it inherits none of the ABC's methods.

The existing mention in "abstract base class" now links to the new term. No
other text is changed.

Docs-only change, so this needs the skip news label.

AI disclosure: prepared with the help of Claude Code; I reviewed the change and the test results.

@python-cla-bot

python-cla-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

read-the-docs-community Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

@sirosen sirosen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm open to alternative opinions, but I think we can improve the text by striking a little bit, and no additional edits.

Comment thread Doc/glossary.rst Resolved
@thejesh23

Copy link
Copy Markdown
Contributor Author

Thanks @sirosen, agreed on both points. I dropped the last two sentences. I have made the requested changes; please review again.

@bedevere-app

bedevere-app Bot commented Nov 3, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

: please review the changes made to this pull request.

@sirosen sirosen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome! I think this is a good addition.

It occurs to me that "virtual subclass" could be used to describe any situation with ABC-like specialized subclass checks. But I think it's best as stated: narrow and easy to understand.

@nedbat, since you filed the original issue, I'm curious what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants