Importing modules for private use in Python There's something I completely dislike when importing a module in an interactive Python shell, typing the name of the module, hitting tab and getting the automatic completion cluttered with other modules that the module itself had imported (but are internal implementation details that are not really useful for me).

Example:

a.py

import os
import datetime

def foo():
    now = datetime.datetime.now()
    print os.path.join(map(str, (now.year, now.month, now.day)))


shell

$ ipython 
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
Type "copyright", "credits" or "license" for more information.

IPython 5.5.0 -- An enhanced Interactive Python.
?         -&gt; Introduction and overview of IPython's features.
%quickref -&gt; Quick reference.
help      -&gt; Python's own help system.
object?   -&gt; Details about 'object', use 'object??' for extra details.

In [1]: import a

In [2]: a.
           a.datetime a.py       
           a.foo      a.pyc      
           a.os                  


I don't care that module a depends on datetime and os, that is distracting me from what the module provides (foo).

So I have started to make my imports private, like this:

a.py

import os as _os
import datetime as _datetime

def foo():
    now = _datetime.datetime.now()
    print _os.path.join(map(str, (now.year, now.month, now.day)))


shell

$ ipython 
iPython 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
Type "copyright", "credits" or "license" for more information.

IPython 5.5.0 -- An enhanced Interactive Python.
?         -&gt; Introduction and overview of IPython's features.
%quickref -&gt; Quick reference.
help      -&gt; Python's own help system.
object?   -&gt; Details about 'object', use 'object??' for extra details.

In [1]: import a

In [2]: a.
           a.foo 
           a.py  
           a.pyc 


Is this considered pythonic at all? I feel like it's a little bit too verbose, but I think simplifying the end user's experience should be above saving some extra tokens per import.
NO
This is not pythonic... and this is ugly... aaah, I can't get that code out of my head...
There is this thing called __all__
1. How does it work
Make a list, put everything you want to make public in it and boom, you're done.
2. What it doesn't do
You will still be able to do my_module.datetime if datetime is imported in my_module
3. What does it do
When you do from my_module import *, it doesn't import datetime.  Autocomplete will use __all__ if it exist. 
4. What are some great conventions that goes with this
You can put it in the __init__.py if it exists
5. Show me
Numpy uses the warning module but it doesn't pollute your namespace.
&gt;&gt;&gt; import numpy
&gt;&gt;&gt; 'warnings' in dir(numpy)
True
&gt;&gt;&gt; 'warnings' in numpy.__all__
False
&gt;&gt;&gt; from numpy import *
&gt;&gt;&gt; warnings
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
NameError: name 'warnings' is not defined


Update:
Every autocomplete in the world* uses __all__ except ipython which uses &quot;some custom logic&quot;(github issue). So I believe the most pythonic solution is go complain on the github issue.
*extrapolation of &quot;the editors I use&quot;