an oop question
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Nov 4 03:11:50 EDT 2022
On 4/11/22 1:29 am, Julieta Shem wrote:
> Perhaps I can reduce the
> class Pair to just being a pair as we know it, made of two things, then
> we create a class called Sequence, which is really a composition of
> Pairs, comes with a length method and we derive Stack from it.
That sounds better. But be careful -- a Sequence class would
probably be expected to have methods for e.g. inserting and
removing things in the middle, which you might not want to
allow for a Stack.
--
Greg
More information about the Python-list
mailing list