It's the way they have build the package.
The last version is for me much more user friendly.
Can of course have in doc that most use
i do not like import like this
The way around this when build own package is to modify
botocore
is a folder that contain session.py
and a blank __init__.py
.botocore/ |-- __init__.py |-- session.py
# session.py def egg(): print('i am foo')Usage:
λ ptpython >>> import botocore >>> botocore.session Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'botocore' has no attribute 'session' module 'botocore' has no attribute 'session' >>> # Have to use >>> import botocore.session >>> botocore.session.egg() i am fooThere is a fix for this bye modifying the blank import in
__init__.py
.# __init__.py from .session import eggUsage:
λ ptpython >>> import botocore >>> botocore.session.egg() i am foo >>> # Now will also work without session,also we can call egg() function in session.py directly >>> botocore.egg() i am fooWhen build a package have to think of stuff like this.
The last version is for me much more user friendly.
Can of course have in doc that most use
import botocore.session.bar.somthing
,i do not like import like this

The way around this when build own package is to modify
__init__.py
(not all in the subfolders but one in main package folder) or also look at __all__
to severe stuff easier to users.