3 ms·
:shrug: I've done that quite a bit. This randomly selected popular Python library does it, too[1]. The example for `os.walk` literally has `from os.path impor
by pfranz 7y ago
:shrug: I've done that quite a bit. This randomly selected popular Python library does it, too[1]. The example for `os.walk` literally has `from os.path import join, getsize`[2]. The docs seem to back this up[3]:
"Remember, there is nothing wrong with using `from package import specific_submodule!` In fact, this is the recommended notation unless the importing module needs to use submodules with the same name from different packages."
I haven't dealt with a lot of C++ code but I feel like I see a lot of `using namespace ...` and haven't seen much `using ...;` (which I think is more readable/acceptable)
[1] https://github.com/psf/requests/blob/df918c066fa275abc2bb0c960647dc064d136a01/requests/utils.py#L22 https://github.com/psf/requests/blob/df918c066fa275abc2bb0c9...
[2] https://docs.python.org/3/library/os.html#os.walk https://docs.python.org/3/library/os.html#os.walk
[3] https://docs.python.org/3/tutorial/modules.html#importing-from-a-package https://docs.python.org/3/tutorial/modules.html#importing-fr...