-
Notifications
You must be signed in to change notification settings - Fork 278
Open
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
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 python/mypy#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.
DetachHead, KotlinIsland, iainelder, nicknystrom, davidfstr and 29 morefang-d and griels
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations