[Tutor] import (fwd)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Thu May 29 17:49:02 2003


Hi Vernon,

tutor-admin@python.org is an address for administrative questions only,
and it only reaches maybe two or three grumpy people... *grin*

I'm forwarding this to tutor@python.org, which is where the main
discussion lives.  Please use 'tutor@python.org' next time.



---------- Forwarded message ----------
Date: Wed, 28 May 2003 18:44:40 -0700
From: Vernon  Miller <vvernon@earthlink.net>
To: tutor-admin@python.org
Subject: import

Last night as I went through the easytut written by Alan Gauld I had to go
back and import the three classes BankAccount, InterestAccount, and
Charging Account after each part of the exercise. Is it normal to import a
class or Module and after running a couple of lines to have to go back and
re- import the classes. What happened is this; "I imported the BankAccount
class and added two accounts"

a = BankAccount(500)
b = BankAccount(200
a.withdraw(100)
b.transfer(100)

"
then I went to the command line and imported InterestAccount, but when I type

c = InterestAccount(1000)

at the command line I got the error message
"BankAccount' is not defined"

It did the same thing when I went on down to the next class ChargingAccount.

Yet both worked fine if at the beginning of each transaction I went back
to the command line and first imported the classes as follows:

from BankAccount import *
from InterestAccount import *
from ChargingAccount import *
;

is it normal to have to stop each time you import a new module or class to
have to go back and re-import(if there is any such word) each class or
module that you had previously used in the program.


Help Please Vernon
vvernon@earthlink.net