Hello everyone, this is my first post here and isn't really linux-related, but I figure someone may be able to help anyway (and sooner or later I will most likely need help with linux too).
This is actually
not a linux problem, it works fine on Linux but not on Windows.
I am trying to get it to work in Windows also because I'd like to use IDLE but haven't quite got xwindows working correctly yet.
I am writing a Yahtzee game in Python. It is not very good, but it is my first attempt at writing any sort of program longer than a few lines from scratch, so that's to be expected.
Code:
import random
...
class Die:
def __init__(self, value=0):
self.value = value
def __str___(self):
return str(self.value)
def __cmp__(self.other):
if self.value > other.value: return 1
if self.value < other.value: return -1
return 0
class DieSet:
#'DieSet' is the five dice that are used each turn
def __init__(self):
self.set = []
#gives each die a value from 1 to 6
for die in range(5):
newDie = Die()
value = int(random.randrange(1, 7))
self.set.append(newDie(value))
...
Whenever I do anything with DieSet() (on Windows), it gives me this error:
AttributeError: Die instance has no __call__ method.
However, when I try to do the exact same thing on Linux, it all works fine. Does anyone know why it's giving me that error, or what to do about it? I don't know exactly what the __call__ method is, in the case it really is needed, and haven't found much helpful information on the Internet as of yet. I am using Python 2.2.1 on WindowsXP.
Maybe I should give up on Windows and do it all on Linux, huh?
Thanks in advance for any replies.
-jeg