Hi Adam, On 1 June 2012 15:45, Adam <amgaw...@gmail.com> wrote: > Is there any benefit to creating a class for each bucket (with an 'update' > method) vs. storing those variables as a dictionary with the 'Room' class as > {'var':0, 'avg': 0, 'sd':0, 'readings':[]} and having the Room class hold > the update function; not so much from good programming practices, but more > attempting to number of resources the class will be using.
I'd submit that worrying about resource usage above/beyond/to the exclusion of worrying about the easy maintenance and readability of your code at this apparently early stage may be a sign of premature optimisation. IMHO the difference in resource usage is going to be fairly negligible either way and you should lean towards prioritising keeping your code easy to read and easy to maintain at this point. How many rooms/buckets are we talking about anyway? (I might add I like Adam also find the triple indexed self.rooms[z][12][85] obscure and would prefer even just say a method with positional and/or names parameters. But I suppose I may feel differently if I worked with your API for a while. :) ) Walter _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor