Taskinoor Hasan wrote: [...] > It make sense :-). So my reasoning......let A is imported in B, i.e. > name A is put in B's namespace. When we call something like A.a then the > interpreter first resolve A in B's namespace, then to get a, it need to > look up A's namespace. And there is no way to populate A's namespace > without executing A, and as all statements, including 'def', 'class' > etc., are treated in the same way, whole script need to be executed. > > So whether a script can be imported as module or not is mainly dependent > on how the script is written and largely on the intention of the coder. > That's right!
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list