[Tutor] Critiquing My Program

Kent Johnson kent37 at tds.net
Sat Oct 11 20:47:48 CEST 2008

On Sat, Oct 11, 2008 at 12:28 PM, Wayne Watson
<sierra_mtnview at sbcglobal.net> 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

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:

For older versions the Bunch class is handy:

> If anyone wants to critique what I have, just ask for a copy.

You could post it to http://pastebin.com/


More information about the Tutor mailing list