Support module-level __getattr__ by JelleZijlstra · Pull Request #3647 · python/mypy
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should allow this to mean Any. The text of the PEP specifies a function;
To make type checkers aware of this, the file can contain the following code:
def __getattr__(name) -> Any: ...
Furthermore, based on the context of the PEP, I think this should only be allowed in stub files. If people want to Any attributes in Python files, it is less intrusive and cleaner imo to have them # type: ignore the file, but I think this needs discussion.