* Mazhar Hussain <[email protected]> [2012-08-14 23:24]: > the module object with the del statement. However what happens if I > try to import a name using 'from' that references a name in the > imported module that itself is not imported. Consider the following > example,here there are two modules mod1.py and mod2.py, > > #mod1.py > from mod2 import test > test('mod1.py') > > #mod2.py > def countLines(name): > print len(open(name).readlines()) > > def countChars(name): > print len(open(name).read()) > > def test(name): > print 'loading...' > countLines(name) > countChars(name) > print '-'*10
Loosely speaking, it does import the other methods. In order to successfully import test(), it has to resolve countLines() and countChars(). They won't be directly accessible, as they don't exist in the namespace, but test() knows about them. You are reading too much into the comment that the module is "deleted". -- David Rock [email protected] _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
