[Tutor] Two More Questions

Britt Green britt_green@hotmail.com
Tue, 27 Feb 2001 17:39:50 -0800


First off, thanks to everyone who helped me out with my previous question.

Now I've got another one. I have the following code added to my Classes.py 
file:

class Items:
    def __init__(self, name, ip):
        self.name = name
        self.inPossesion = ip

class Containers(Items):
    def __init__(self, name, ip, oc):
        Items.__init__(self, name, ip)
        self.openClosed = oc

class Rooms:
    def __init__(self, name):
        self.name = name

Then I have this code which uses the Classes.py file:

import Classes

cupboard = Classes.Containers("cupboard", 0, "closed")

key = Classes.Items ("worn key", 0)

kitchen = Classes.Rooms("Kitchen")

However, when I run the above code, Python replies with this:

>>>
Traceback (innermost last):
  File "C:/Program Files/Python20/game.py", line 7, in ?
    kitchen = Classes.Rooms("Kitchen")
AttributeError: Rooms

What might be causing this? I've checked for typos and whatnot, but I don't 
see any.

Also, I was wondering how I could put a fairly large string into the 
constructor. If I had a couple of paragraphs of a room description, what 
would it look like when I called the constructor? I haven't been able to 
figure out how to get Python to accept multi-line strings this way.

Thanks!

Britt

--
It is pitch black. You are likely to be eaten by a grue.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com