modules and namespaces

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mage

    #1

    modules and namespaces

    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


Working...