Q: Misunderstanding classes (newbie)
sorry at spam.invalid
sorry at spam.invalid
Tue Feb 22 16:52:16 EST 2000
Hi,
I'm a Python newbie (and an OOP newbie) trying to
construct a class that:
(a) behaves like a list but has a FORTRAN-like variable
starting index,
(b) has per-index attributes.
i.e. Each element of the list has two (or more) attributes,
and, by default, the first element is at x[1].
e.g. x[1].lastname, x[1].firstname, x[1].age
x[2].lastname, x[2].firstname, x[2].age
I seem to be able to get each part of the solution
independently (the first part by using UserList and
__getitem__), but when I attempt to combine them, I
clearly don't understand what I'm doing.
Suggestions?
Thanx.
P.S. Please respond to the list.
More information about the Python-list
mailing list