Private identity objects are not singletons.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 302
- Avg merge
- 23h
- Merged PRs (30d)
- 8
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the “Support for singleton types in unions” subsection in the linked typing specification. Clarify that an object() instance is not inherently a singleton, explain why Enum is needed for singleton typing, and preserve the distinction from a private object whose identity is checked only within its module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100