[Tutor] Re: generla import questions

Lee Harr missive@hotmail.com
Sat Apr 5 21:27:02 2003

>Say I have an app that does
>import a
>import b
>import c
>and some actual code.
>And in module b I have
>import c
>Are there now two copies of c in memory, are does all the class data and
>variables etc only exist once?

Just one copy

>Or put hit this way, if module c is:
>abc = "123"
>and module a does c.abc = "1234" in some function, and module b then
>prints c.abc what gets printed?

Try it. That is one of many cool things about python: you can
fire up the interpreter and type things at it and see what it

21:05 >cat > c.py
abc = "123"
21:21 >cat > a.py
import c
c.abc = "1234"
21:22 >python
Python 2.2 (#1, Jan 23 2002, 06:46:11)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>>import c
>>>import a

MSN 8 with e-mail virus protection service: 2 months FREE*