26.04.18 16:51, Nick Coghlan пише:
Forcing submodule imports would be the main thing, as at the moment,
you have to choose between repeating the base name multiple times
(once per submodule) or losing the hierarchical namespace.
If the base name is short, there are no problems with repeating it. If
it is long, it is better to get rid of this prefix than repeat it every
time when you use submodules.
In any case it takes pressing just a few keystrokes in modern editors
for duplicating an import line for editing the last component.
So where:
from pkg import mod1, mod2, mod3
bind "mod1", "mod2", and "mod3" in the current namespace, you might
instead write:
from pkg import .mod1, .mod2, .mod3
to only bind "pkg" locally, but still make sure "pkg.mod1", "pkg.mod2"
and "pkg.mod3" all resolve at import time.
I think this special cases isn't special enough to introduce a special
syntax.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/