Why is __path__
a list?
>>> my.module.__path__
['/path/to/my/module']
The short version is because a package can reside in more than one directory.
The slightly longer version is that a package can reside in more than one directory to allow large packages to be distributed as a collection of smaller ones, facilitating both updates (which don't require the entire packages to be updated but just the corresponding smaller one) and to provide optional components.
The longer and complete answer can be found in PEP 420.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With