Skip to content

gh-148639: Implement PEP 800 (typing.disjoint_base)#148640

Open
JelleZijlstra wants to merge 5 commits intopython:mainfrom
JelleZijlstra:pep800
Open

gh-148639: Implement PEP 800 (typing.disjoint_base)#148640
JelleZijlstra wants to merge 5 commits intopython:mainfrom
JelleZijlstra:pep800

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented Apr 16, 2026

Comment thread Doc/library/typing.rst
Comment thread Lib/typing.py
and determine when two types can overlap.
"""
cls.__disjoint_base__ = True
return cls
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.

Should it try..catch on (AttributeError, TypeError), similar to @final?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, we added that to final for backward compatibility since previous versions of the decorator didn't do it. Newer decorators that have had this assignment since the beginning (such as @dataclass_transform) don't use it.

Comment thread Doc/library/typing.rst
JelleZijlstra and others added 2 commits April 16, 2026 05:51
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants