Hi,
Just started playing around in Python. Copied out a example off of Sourceforge and it didn't work (after writing my own class and that didn't work either

). Neither did any other examples, so maybe i am missing something that is a assumed in the examples
THis is what i wrote in the interpreter (WIndows version of the IDLE Python 2.3)
Code:
first try:
>>> class SimpleClass:
def _init_(self):
self.data = 3
def get(self):
print self.data
>>> m = SimpleClass()
>>> m.get()
Traceback (most recent call last):
File "<pyshell#12>", line 1, in -toplevel-
m.get()
File "<pyshell#10>", line 5, in get
print self.data
AttributeError: SimpleClass instance has no attribute 'data'
and second try:
>>> class SimpleClass:
def _init_(self, init_val):
self.data = init_val
def get(self):
print self.data
>>> m = SimpleClass(1)
Traceback (most recent call last):
File "<pyshell#6>", line 1, in -toplevel-
m = SimpleClass(1)
TypeError: this constructor takes no arguments
anyone know why its not working???
Thanks