[Python-Dev] Imports with underscores

Barry Warsaw barry at python.org
Mon Jan 9 11:20:16 EST 2017


On Jan 09, 2017, at 11:42 AM, Steve Holden wrote:

>So I thought it would be useful to get input from current devs about the
>value of this practice, since to me it seems somewhat anti-pythonic. What
>advantages does it confer?

It just means you can't accidentally import it with a from-import-* since
those ignore underscored names by default.

(But then if you use __all__'s it won't happen anyway because you'll never put
'os' in __all__.)

(Aside from the fact that from-import-* is usually bad form, and the problem
with __all__ <wink> [1].)

Cheers,
-Barry

[1] http://public.readthedocs.io/en/latest/#the-problem


More information about the Python-Dev mailing list