On Sat, Oct 11, 2008 at 12:28 PM, Wayne Watson <[EMAIL PROTECTED]> wrote:
> Perhaps at the top of my list is the use of self. I sure get tired of using > it. Maybe there's a short cut. No, no short cut. You can use a different name than 'self', for example 's', but I don't recommend it; 'self' is pretty universal in Python. It's possible you are over-using attributes; values which are only used in a single method don't have to be attributes. > Although I've organized the file data into > records, I still find subscripting fields and data a bit unpleasing. For > example, I used a list of tuples, but I'd list to represent items by names > rather than indicies to enhance readability. Python 2.6 adds a namedtuple function which is useful for this: http://docs.python.org/library/collections.html#collections.namedtuple For older versions the Bunch class is handy: http://code.activestate.com/recipes/52308/ > If anyone wants to critique what I have, just ask for a copy. You could post it to http://pastebin.com/ Kent _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
