Wrapper/Proxy Generic Type
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 302
- Avg merge
- 23h
- Merged PRs (30d)
- 8
Description
I've been putting some work into typeshed pull requests and I've noticed some places where I could really have used a Proxy Generic class - meaning I can inherit from Proxy[T] and that means that whatever attributes T has, Proxy[T] also has. We don't want to directly mark this as inheritance since then the distinction of a proxy is lost.
The examples I ran into are ProxyType and CallableProxyType in weakref or SynchronizedBase in multiprocessing,csharedtypes.
A big one would be unittest.Mock (See https://github.com/python/mypy/issues/1188).
I'm sure other cases exist,
Advantages:
- Representing a proxy type easily
- Allowing type checkers to enforce typing
Disadvantages:
- Functions that get T won't accept Proxy[T] as an argument. Although the current state is probably something similar.
I'd really like to hear some opinions on the idea.
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 by reading the proposal and its discussion, including the examples involving weakref, multiprocessing.sharedctypes, and unittest.Mock, plus the linked mypy issue. A useful outcome would require agreement on whether Proxy[T] belongs in the typing design and a clear specification of its behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100