On 3/11/22 1:37 pm, Julieta Shem wrote:
The code for computing the length of a Pair (which is really a linked list) happens to be the same for computing the length of a Stack.
I would question whether that should be a method of Pair at all, since it's not the length of the pair itself, but the length of a structure built out of pairs. But in any case, the way to do this in a conceptually clean way is for the length method of Stack to call whatever it is that computes the length of a linked list of Pairs. This is what the term "delegation" refers to. -- Greg -- https://mail.python.org/mailman/listinfo/python-list