[spec] Clarification: Are symbols not listed in `__all__` ever considered public?
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
According to https://typing.readthedocs.io/en/latest/guides/libraries.html#library-interface-public-and-private-symbols:
A module can expose an
__all__symbol at the module level that provides a list of names that are considered part of the interface. This overrides all other rules above, allowing imported symbols or symbols whose names begin with an underscore to be included in the interface.
Does this mean that if __all__ is present: ① A symbol is public if and only if it is listed in __all__ or ② If a symbol is listed in __all__, it is public, but things not listed in __all__ can still be considered public as well?
For example:
# module.py
__all__ = ["identity"]
from typing import TypeVar
T = TypeVar("T")
def identity(x: T) -> T:
return x
Are TypeVar and T considered public members of module.py? If so, what is the suggested way to exclude them? T could be renamed to _T, but is one supposed to do from typing import TypeVar as _TypeVar, if one wants TypeVar to not be considered a public member of module?
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
Empieza con la guía enlazada «Library Interface: Public and Private Symbols» y compara su redacción de all con el ejemplo module.py del issue. Se considera terminado cuando el comportamiento de los símbolos públicos queda aclarado en la documentación, incluido cómo deben excluirse, cuando corresponda, los nombres importados y las declaraciones de TypeVar.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100