Module Name

Hans Nowak hnowak at cuci.nl
Wed Aug 15 14:18:14 CEST 2001


>===== Original Message From "Kerim Borchaev" <warkid at storm.ru> =====
>  Thanks - it worked.
>
>  But what does it mean "module object"?
>  When I pass MyModule0Name ( without quotes ) to loadTestsFromModule
>  - do I pass "module object" or what?

Yes; the import statement creates a module object in the current namespace. 
Compare:

>>> import unittest
>>> unittest
<module 'unittest' from 'd:\python21\lib\unittest.pyc'>
>>> type(unittest)
<type 'module'>
>>> "unittest"
'unittest'
>>> type("unittest")
<type 'string'>
>>>

Modules are first-class objects, just like integers, strings, etc. This means, 
among other things, that you can pass them to functions, inspect them, etc. 
(Unlike languages like, for example, Pascal, where "uses MyUnit;" does not 
create an object MyUnit available for use.)

HTH,

--Hans Nowak





More information about the Python-list mailing list