[Tutor] Some advice on classes needed ?

Dave S pythontut at pusspaws.net
Sat May 15 04:20:25 EDT 2004


Good Morning,

I need to analyze some data, each set of data will consist of 600 
numbers, added to on each sweep of another
python program. The data structure will remain at 600, new data pushing 
oldest data out. After each 'sweep' various statistical
functions will need to be applied to this data set of 600 and results 
returned.

Multiply this by 250 sets & there is my problem.

I could make a giant matrix 600,250 then program code to sweep the 
matrix to provide the results.

But I have just read about classes :-)

If I design a class for one set of data, how do I generate all the 
instances of classes without 250 generate instances.

data1=datastruct()
data2=datastruct()
...
data250=datastruct()

Following on, how can I sweep the 250 data structures instances to get 
statistical data without manually doing 250 instance calles.

What I am asking is, Is it possible to use a for loop ? ie dynamicly 
generate an instance name to then call ?

Hopefully this is an intelegent question - this is the first time I have 
ever tries OOP ! :-)

Dave




More information about the Tutor mailing list