[Tutor] designing a class
Christopher Spears
cspears2002 at yahoo.com
Thu Jan 26 22:12:54 CET 2006
Here is an exercise out of Learning Python:
Write a class called Mylist that shadows ("wraps") a
Python list: it should overload most list operators
and operations including +, indexing, iteration,
slicing, and list methods such as append and sort.
See the Python reference manual for a list of possible
methods to support. Also, provide a constructor for
your class that takes an existing list (or a Mylist
instance) and copies it components inro an instance
member.
When I read this, I feel like a deer caught in the
headlights. Where should I begin? How do I go about
designing a new class?
More information about the Tutor
mailing list