Description
I was writing up an Issue on the Pylance project as I found a built-ins-example of my seen behavior in question which is the xml package with its stub here:
typeshed/stdlib/xml/__init__.pyi
Line 1 in 72ee95b
So a submodule is imported marked as exported publicly there right away. Now my issue:
I understand that one can import submodules like import xml.parsers
and such ... but
If you actually import just xml
there is no xml.parsers
!
>>> import xml
>>> xml.parsers
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'xml' has no attribute 'parsers'
The real file actually hints about 3 more submodules which are also never there on basic xml
import.
(Edit: yeah that's intended! __all__
is just about broad imports! Pardon me)
Am I mistaken that the stub and the suggests that this submodule would be available?__all__
declaration
Is this a historic thing to help auto-completers along? I'd think type-checkers are much smarter nowadays.
But maybe I'm just missing something here :)
cheers:
ëRiC