[Tutor] Class stuff
Thu, 23 Nov 2000 09:27:48 -0600
I saved your snip of code as Room.py on my 'puter and typed "import
Room" in IDLE. After making a change to indentation, it ran without
Richard Wilkins wrote:
> Hello everyone,
> I'm _positive_ it's a newbie question, so brace yourselves.
> I have a regular old dictionary called Rooms, and a class called Room.
> Room is defined as follows -
> class Room:
> def __init__(self,x,y,z):
> if Rooms.has_key(str(x)+','+str(y)+','+str(z)):
> print 'Room already exists'
> When I create an object it all works fine. When I type Rooms at the
> interpreter prompt, it says:
> "call of non-function (type None)"
> I've debugged it down to the last line, so that referencing the class as
> self does not work. I need to know how to reference the class from
> within itself. I don't want to have to provide a function that wraps the
> Can someone please help me with my problem?
> Andrew Wilkins
> Tutor maillist - Tutor@python.org