Re: [Tutor] Some advice on classes needed ?
by Dave S other posts by this author
May 15 2004 2:12PM messages near this date
Re: [Tutor] Some advice on classes needed ?
|
Re: [boost] Re: [Boost.Thread] mutex Win32 implementation changes
Alan Gauld wrote:
> >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()
> >
> >What I am asking is, Is it possible to use a for loop ? ie dynamicly
> >generate an instance name to then call ?
> >
> >
>
> You don't need an instance name, you can store them ina list
> orvdictionary.
> There is a section at the end of my web tutor topic on OOP that shows
> how to do this.
>
>
.... can you tell me where I can read this "web tutor topic" ... I think
I would find it helpfull
Thanks
Dave
> One thing to consider however is your design, remember that objects
> own their own dsata arnd are responsible for processing it, so think
> carefully about how that concept might change the basic way your
> program functions. Are you going to pass a set of files to each
> object to extract its own data? Or are you going to going to pass
> each file in turn to each of the objects? Or are you going to
> extract the data in bulk and then pass it to the object (so how do
> you know what data each object needs if the object manages its own
> data?)
>
> Without knowing more about the details its impossible to say which
> mechanism will work best. But large volume data cruunching can be
> extremely inefficient if you get the approach wrong.
>
> Alan G.
>
>
>
>
>
_______________________________________________
Tutor maillist - Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Dave S
Glen Wheeler
Dave S
Alan Gauld
Dave S
|