[Tutor] module versus file
Kermit Rose
kermit at polaris.net
Thu Jun 8 00:44:08 CEST 2006
Message: 7
Date: Wed, 07 Jun 2006 08:12:59 -0400
From: Kent Johnson <kent37 at tds.net>
Subject: Re: [Tutor] default module
>>>>>>>>>>
Hi Kermit,
To make a module available for import, you just have to save it
somewhere on your Python path. There are several ways to do this,
*******
Yes. By some means that I don't remember I declared the file factor30.py
in directory
math\factoring
to be a module.
>>>>>>>>>>>>
but if
you want to make another importable module just save it in the same
location as factor30.py.
***************
Are you saying that any .py file that I save in math\factoring
can be imported?
>>>>>>>>
There is no practical limit on how many modules
you can have - just RAM and disk space limits,
AFAIK.
******
Had to look up the acronyn.
What is AFAIK?
It's an acronym for As Far As I Know.
>>>>>>>>>>
You already have
many modules installed as part of the standard library and any
third-party add-ons you have installed.
**********
Yes. I'm impressed with the listing in built_in.
I assumed system modules were handled in a different way than user modules.
*********
>>>>>>>>
If you are working with a module from the interpreter and you make
changes to the module, you have to reload it with the command
>>> reload(factor30)
*****
I will try the reload command next time I work with factor30.
>>>>>>
This won't work for local names (from factor30 import xx)! Just use the
full name to access any elements of factor30, e.G. factor30.gcd. Read
******
In order to have the shorter name,
gcd
instead of factor30.gcd,
I prepare by
typing
from factor30 import gcd
Once someone said that modules and files are not the same thing.
This statement left me puzzled. Why not?
Kermit < kermit at polaris.net >
More information about the Tutor
mailing list