[Tutor] Re: generla import questions
Sun Apr 6 18:05:08 2003
OK, I'll have a go at taking a diffeerent angle on this.
>Say I have an app that does
>and some actual code.
>And in module b I have
>Are there now two copies of c in memory, are does all the class data and
>variables etc only exist once?
Remember that a module in Python is an object much like any other object.
c is the name of a module object and when ytou import c you import the
'c' which referes to that module object.
Thus it doesn't matter into how many diffrent namespaces you import the name
c it will refer to the same module object. If you change that modules
data then it will be changed for all the referenbces since they are all
the same module object.
An import is very different to a C include statement.