"Jeff Peery" <[EMAIL PROTECTED]> wrote > I am taking measurements and building up a list of objects > for each measurement. the class I created for the objects has > attributes > I also have functions within my class (I think they are properly > named 'accessors'?) that get a piece of data within the object,
You don't really need these in Python. Unless they are performing some manipulation of the data its perfectly acceptable to get the data directly from the object. Having an accessor for every attribute is a fashion quirk carried over from Java which needs it for its Javabean spec. Python OOP tends to take a much more relaxed approach to attribute access. > I'm wondering what happens to my performance as I > add more accesors to my class. How are the accesors managed? Adding methods to a class does not significantly affect the objects. The methods are stored as objects in a dictionary in the class and the instances just have a reference to the class. Thus all you are doing is adding method code to the class and an extra entry to the dictionary. > will my list of objects become huge and slow as I add more > accessors? No, the dictionary lookup is nearly constant in time regardless of size. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor