Packages, modules, libraries,...

Gordon McMillan gmcm at hypernet.com
Tue Feb 1 09:05:52 EST 2000


Mikael Olofsson wrote:
> 
> I've seen the words package, module, and library, used in this group 
> frequently. I'm the naive type of programmer, so I thought that these
> were synonyms. Now, some people seem to use these words as such, but
> then there are others who seem to distinguish between them. What is
> true? Are perhaps both views true in some sense? Could someone please
> enlighten me.

A module is a very well-defined thing (it has a C level type 
object). This is where code lives (eg, string.py). A package is 
a (well defined) way of organizing modules. A directory 
containing an __init__.py module is a package, and modules 
therein can be imported as "<dirname>.<modulename>". A 
library is an ill-defined thing; most probably used to mean a 
directory of modules without an __init__.py, but since it has 
no exact meaning in Python, it's hard to say for sure.

- Gordon




More information about the Python-list mailing list