Organizing Python

s713221 at s713221 at
Tue Mar 20 01:04:05 CET 2001

> from the module foo. A module is usually represented by a file, but it
> is also possible to have it be a directory which I once read something
> about on, but I can't find it now. 

If you place a file called __init__ into a directory on your path,
python imports that as the name of the directory.

		-----> #contains python instructions to load code from
		|		files
		----->other/files/and/directories which make up FFT

>>>import FFT	#Imports FFT/
>>>print "Handy, ain't it?"

Another method is to put a file called module_name.pth into your python
path, containing the name of a directory that the module is in. (What
I've used to get Numeric working without fiddling with my /etc/profile
or ~/.bashrc files.).

less /usr/lib/python2.0/site-packages/Numeric.pth


In this case, python loads the file with the name of the module

					----> other numeric files

>>>import Numeric	# Imports Numeric/
>>>print "A little bit messier, but maybe what the original poster was looking for?"

Joal Heagney/AncientHart

Joal Heagney/AncientHart

More information about the Python-list mailing list