Wrapper/Proxy Generic Type
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
Piste de recherche
Commencez par lire la proposition et sa discussion, y compris les exemples impliquant weakref, multiprocessing.sharedctypes et unittest.Mock, ainsi que l’issue mypy liée. Un résultat utile nécessiterait de parvenir à un accord sur l’inclusion de Proxy[T] dans la conception de typing et de disposer d’une spécification claire de son comportement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
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.
- Langage dominant
- Python
- Étoiles
- 1.8k
- Forks
- 302
- Merge moyen
- 23 h
- PR mergées (30 j)
- 8
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python/typing
-
topic: typing spec
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
topic: typing spec
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
topic: documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
topic: documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
topic: conformance tests topic: typing spec
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
Toutes les issues de python/typing
Issues similaires
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Ouvertearea: ci bug perceived difficulty: 3
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
ClickHouse/clickhouse-connect#1057 ·