On 1/19/06, Peter Bowyer <[EMAIL PROTECTED]> wrote: > At 20:28 18/01/2006, Andre Roberge wrote: > >Fido.left_front_paw.moves() > > I have a query about this call. The way the left_front_paw moves is > not going to be very different from right_front_paw or the back > paws. Now if it's identical, in a simplified model, does not > Fido.moves(Fido.left_front_paw) > make more sense? It is harder to understand, and I'm not happy with > the argument to the method, but it promotes code reuse. > > Peter
Since this is intended to be the first introduction to the dot notation, I think it would be a bit more confusing then necessary. What I want to illustrate is the "chaining" that can occur with using the dot notation. It is more the notation, than the underlying implementation that I want to introduce at this point. In term of promoting code reuse, my first inclination would be to have something like Fido.left_front_paw = Paw() # Paw() is a class, with a move() method Fido.right_front_paw = Paw() instead of having a method argument. [One might argue that Fido.move() has to imply that each individual paws must move, hence your observation about having it as a method argument instead ... hmmmm... ] I'll have to think about it further and I thank you for your suggestions. André _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
