Where to "import"?
Terry Reedy
tjreedy at udel.edu
Thu Mar 8 14:38:27 EST 2007
"Paulo da Silva" <psdasilvaX at esotericaX.ptX> wrote in message
news:1173379952.901004 at iceman.esoterica.pt...
| Hi!
|
| If I have two files .py such as
|
| m.py
| from c import *
| ...
| x=c()
| ...
| os.any_method ...
| ...
|
| c.py
| class c:
| def __init__(self, ...):
| ...
| os.any_method ...
| ...
| ...
|
| both using os module where should I put the "import os"? In both files?
I would even though having it in m.py is not *currently* necessary. Having
the import of os into m.py depend on the way you write and import c.py
looks fragile, and it certainly is a memory burden to remember that c does
so. Also, I probably would use 'import c' instead.
tjr
More information about the Python-list
mailing list