On Nov 15, 3:37 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:

> > Also, I've seen talk that ideally you shouldn't have too many "dots"
> > in your method calls, instead using delegates to the methods and
> > attributes. Can anyone elaborate on this? Ideally, should I be writing
> > getattr() methods so I can do pet.address instead of
> > pet.owner.address? Should I be doing the same with owner's methods
> > like I did with get_foo()?
>
> No, that's certainly not a good idea. And I'm under the impression you
> misunderstood something there in the original lecture/explanation.

Having read lots of "perspectives" on OO style, it wouldn't surprise
me if the OP understood the point perfectly.

I.e., there probably are people out there who suggest that when you
have something like this:

mypet.owner.get_attributes()

you should reverse-refactor it into something like this:

mypet.get_owner_attributes()


I would agree that the former is preferable, especially in cases like
this one where the classes aren't really closely related.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to