Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is __path__ a list?

Why is __path__ a list?

>>> my.module.__path__ 
['/path/to/my/module']
like image 358
Lucas Avatar asked Mar 01 '14 16:03

Lucas


1 Answers

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.

like image 101
isedev Avatar answered Sep 28 '22 19:09

isedev