Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private identity objects are not singletons. #1949

Open
Alex-Wasowicz opened this issue Mar 24, 2025 · 0 comments
Open

Private identity objects are not singletons. #1949

Alex-Wasowicz opened this issue Mar 24, 2025 · 0 comments
Labels
topic: typing spec For improving the typing spec

Comments

@Alex-Wasowicz
Copy link

In the subsection describing singletons in unions, widely used object() example is described as a singleton, but it isn't one. It should be clearly stated that the problem for typing system is that this instance is not a singleton, that's why Enum is needed.

_empty = object() works with is check, because identity of _empty doesn't leak outside of module. There is nothing singleton about that. Typing spec can allow requiring _empty to be one, to allow use with is, but that should be clear it's the case.

@Alex-Wasowicz Alex-Wasowicz added the topic: documentation Documentation-related issues and PRs label Mar 24, 2025
@srittau srittau added topic: typing spec For improving the typing spec and removed topic: documentation Documentation-related issues and PRs labels Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: typing spec For improving the typing spec
Projects
None yet
Development

No branches or pull requests

2 participants