just feeling my way into Python with a small app that reads data from file, creates objects using that data, stores the objects in a list, loops over the list doing comparison tests to filter out various objects. Here is a code snippet:
class myObj:
def __init__(self,a,b):
self.a=a
self.b=b
def get_a(self):
return self.a
def get_b(self):
return self.b
# Read data from file
L1=[]
nobj=0
for line in input:
# Filter data
for i in range(1,nobj):
Trying to debug this using IDLE. The calls x.get_a and x.get_b always return zero so something is going wrong somewhere. I think I'm either not storing the objects correctly or retrieving them correctly but no idea why! All suggestions gratefully received!!!
Thanks in advance
Alun Griffiths
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor