egbert wrote: > When I do 'from some_package import some_module' > the __init__.py of some_package will be run. > However, there will not be anything like a package-module, > and the effects of __init__.py seem all to be lost. Is that true ? > Or can I still do something useful with __init__.py ? > e
If I understand correctly what you mean byt a "package-module" then __init__.py is exactly what you are looking for. Many packages are built with an empty __init__.py because they are intended mostly to build a tree-like set of namespaces, but __init__.py *is* run when the package is imported, and its namespace is bound to the name of the package within the importing program. So if you have code you want to run when the package is imported, put it there. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS: http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list