On Thu, 26 Apr 2018 at 19:10 Julian DeMille via Python-ideas <
python-ideas@python.org> wrote:

> Some library authors get pretty pissy about implicit imports at the root
>
> On Thu, Apr 26, 2018, 09:37 Paul Moore <p.f.mo...@gmail.com> wrote:
>
>> On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
>> <python-ideas@python.org> wrote:
>> > I personally would like a feature where instead of doing `from ...
>> import
>> > ...` (which imports the specified items into the current namespace), one
>> > could use something along the lines of `import <lib>.{ <mod1>, <mod2>,
>> ...
>> > }` such that the imported modules/attributes could be accessed as
>> > `<lib>.<mod1>`, etc.
>>
>> What are the benefits of this over a simple "import <lib>"? I get that
>> it will mean that *only* the names listed will be accessible as
>> <lib>.<mod>, but I don't see why that's important (and specifically
>> why it's important enough to warrant dedicated syntax). Hiding names
>> in a namespace isn't typically something that Python provides language
>> support for.
>>
>> Paul
>>
> --
> Thanks,
> Julian DeMille
>
> CEO, demilleTech, LLC
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify the system manager.
> This message contains confidential information and is intended only for the
> individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. If you are not the intended recipient
> you are notified that disclosing, copying, distributing or taking any
> action in reliance on the contents of this information is strictly
> prohibited.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>

The following works today:

Python 3.6.3 (default, Oct  4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os
<module 'os' from
'/Users/pradyunsg/.venvwrap/venvs/pip/bin/../lib/python3.6/os.py'>
>>> os.path
<module 'posixpath' from
'/Users/pradyunsg/.venvwrap/venvs/pip/bin/../lib/python3.6/posixpath.py'>

I am not sure what you're asking for here.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to