Thomas J. Gallen <kaori.hin...@gmail.com> added the comment:

Yes, a package. There isn't actually that much in the txz. Most of the files 
are ostensibly empty.

As an example, let's say we have the following files:

test.py
test_module/__init__.py
test_module/test_submodule.py

test.py contains:
```python
import test_module
print(test_module.test_submodule)
```

test_module/__init__.py
```python
from .test_submodule import *
```

test_module/test_submodule.py is completely empty.

Assuming `from x import *` acts like it does elsewhere, `dir()` before and 
after the import (in `test_module/__init__.py`) should return the same result 
(as there's nothing to import, and I haven't made an explicit import of module 
itself.) In this case, `test_module.test_submodule` is being added to the 
parent class anyway. That's what I was referring to above regarding 
`_find_and_load_unlocked`.

I was looking into this, not because I want to use it (I don't), but because 
the *standard library* is using it in multiple places, and not performing 
explicit imports. In my case, this results in a slightly more complicated 
series of events where pylint thinks that attempting to access any member of 
`asyncio.subprocess` (for example, `Process`) isn't possible because 
`subprocess` hasn't actually been imported into `asyncio`'s module namespace. I 
have an issue open for that with PyCQA/pylint already.

Based on the documentation, and how `*` imports behave most of the time, pylint 
would appear to be correct in that `subprocess` has not been imported into 
`asyncio`'s module namespace, and as such should not be accessible. Above is a 
generic example of that behavior. I would assume that `test.py` should fail 
with an AttributeError, but in this case it does not.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43477>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to