modules and namespaces

M

Mage

Hello,

I thought that this will work:

#m1.py
def f1():
return string.join('a','a')

#m2.py
def f2():
return string.join('b','b')

#main.py
import string
import m1
import m2

print f1()
print f2()

---------

However it doesn't work until I import the string module into m1 and m2
modules. I found in the manual that imported modules will be searched in
the container module first. Is it more efficient to import the string
module into main and m1 and m2 than importing only into m1 and m2?

Mage
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top