LoD questions

Paul Winkler slinkp23 at yahoo.com
Wed Sep 19 11:01:25 EDT 2001


On Wed, 19 Sep 2001 08:58:27 GMT, Roeland Rengelink 
<r.b.rigilink at chello.nl> wrote:

>Paul Winkler wrote:
(snip) 
>> But it may not be practically possible to put methods for every
>> possible thing directly in foo, or else I'll have hundreds of methods
>> that look like
>> 
>> x = foo.get_bar_bat_baz("baf")
>> 
>
>Note that you've really only replaced dots with underscores here. The
>structural knowledge is still there.

I noticed that. :) I was pretty sure, for that reason, that that
*wasn't* the intention of the LoD.

>You may already be in trouble. x just wants a baf. If it has to tell foo
>where to get it, foo is not the place to get it from. (or baf may not be
>the proper thing to ask from foo, or x is in the wrong place, or baf is
>in the wrong place, or oomps baf is not really a baf, or...)

OK. So it's really more a sign of trouble than a prescription for a
cure.

>Just one hint, beware of the FORTRAN common block. If foo's only
>function is to pass
>bar and oops around, then just pass bar and oops around, and get rid of
>foo.

No, in this case foo has a very well defined job, and so does bar. I'm
now going through my code looking for places where I need to know that
foo has a bar, and considering other ways of organizing it.

Thanks for the comments, this is very helpful!

--PW



More information about the Python-list mailing list