Consider adding a "TopLevel" keyword that stands in for the top level bound of a corresponding type variable
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 1.8k
- Forks
- 302
- Merge medio
- 23 h
- PR fusionados (30 d)
- 8
Descripción
Summary
Please consider a new typing keyword that stands in for the top level type of a corresponding type variable.
Motivation
Consider a test here and the corresponding definition of DistributionInfo here. The test loses all typing information because I used DistributionInfo[Any, Any, Any]. So if I want typing information, I have to use:
def test_flatten(generator: Generator,
distribution_info: DistributionInfo[NaturalParametrization[ExpectationParmetrization, JaxComplexArray],
ExpectationParametrization[NaturalParmetrization],
NumpyComplexArray]) -> None:
I would much rather just do
def test_flatten(generator: Generator,
distribution_info: DistributionInfo[TopLevel, TopLevel, TopLevel]) -> None:
It's not just shorter, but it reduces churn if the type definitions change. Note that TopLevel is recursive (it chooses the top level of the nested types too).
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con los tests vinculados tests/test_flatten.py y tests/distribution_info.py para entender qué información de tipos se pierde cuando se usa DistributionInfo[Any, Any, Any]. Aclara la semántica recursiva prevista de TopLevel y en qué se diferencia del comportamiento existente de las variables de tipo. Se considerará terminado cuando la propuesta incluya una especificación precisa y un proceso de validación acordado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- devtools
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100