[Tutor] writing methods

Christopher Spears cspears2002 at yahoo.com
Wed Feb 25 20:04:03 EST 2004

I am trying to solve the following homework

Using the UserDict module, create a class called
Odict, which will be just like a dictionary but will
"remember" the order in which key/value pairs are
added to the dictionary. (Hint: Override the built-in
__setitem__ method.) Create a new method for the Odict
object called okeys, which will return the ordered

I don't expect to get the answer, but I would like to
be pointed in the right direction.  I think my major
problem is that concepts that surround writing methods
are still not transparent to me.  I find myself
spending a lot of time staring at the UserDict module
code, scratching my head, and trying out stuff in IDLE
to figure out how the code works.  Is there a good
tutorial or something on the web that will clear these
concepts ups for me?

"I'm the last person to pretend that I'm a radio.  I'd rather go out and be a color television set."
-David Bowie

"Who dares wins"
-British military motto

"The freak is the norm." - "The Infernal Desire Machines of Dr. Hoffman" by Angela Carter

More information about the Tutor mailing list