[Distutils] (final?) automake related questions
Wed, 14 Apr 1999 11:37:31 -0400
Quoth Andrew Dalke, on 07 April 1999:
> Quick clarification question, then.
> What do you call a single file which is placed in
> and referenced via 'import something'
I call that a module. But that's not the only kind of module!
> and what do you call a set of files contained in a directory
> named 'something_else', placed in
> and contains the __init__.py to tell Python that this importable via
> import something_else
I call that a package. But remember, a package is also a module!
> Is something == 'module' and something_else == 'package' ?
So yes, this is correct.
> If so, I want to change my name for the first (currently is 'classes',
> for lack of a better word) and the second from 'module' to 'package'.
Calling a module "classes" is ugly and doesn't tell the whole story (a
module can also provide functions and global variables!). Calling a
package a module is *very* confusing! I definitely think you should
make this change.
Here's my take on packages and modules in Python:
A Python source file ending in ".py" and living in a directory on
sys.path is a "module". But this isn't the only kind of module. A
directory living on sys.path containing a file called "__init__.py"
is a special kind of module called a "package". A platform-specific
dynamically loaded file on sys.path might also be a module, usually
called an "extension module". In general, modules can provide any
kind of Python object, where something "provided by" a module may be
directly pulled into another namespace using "from module import
name", or accessed via the module as "module.name". Usually,
packages only provide other modules, but they can provide classes,
functions, variables, etc. Usually, "pure Python" modules provide
classes, functions, and variables, but they can provide other modules
(eg. 'os' provides a module called 'path'). And usually, extension
modules only provide functions and variables -- my understanding is
that they cannot provided classes, and I have no idea what the other
hard-and-fast limitations on extension modules are (I really have to
play around more there!).
Assuming all that is correct, I hope that clears things up! (And if
anything up there is *not* correct, somebody tell me soon before I
hard-code my misunderstandings in the Distutils...)
Greg Ward - software developer firstname.lastname@example.org
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913