[Tutor] Class stuff
Richard Wilkins
wilkins@iinet.net.au
Thu, 23 Nov 2000 18:17:56 +0800
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):
self.Position=(x,y,z)
self.this=self
if Rooms.has_key(str(x)+','+str(y)+','+str(z)):
print 'Room already exists'
else:
Rooms[str(x)+','+str(y)+','+str(z)]=self
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
class...:(
Can someone please help me with my problem?
Thanks,
Andrew Wilkins