LoD questions

Paul Winkler slinkp23 at yahoo.com
Wed Sep 19 05:23:12 CEST 2001


On Tue, 18 Sep 2001 21:42:46 +0100, Ype Kingma <ykingma at accessforall.nl> wrote:
>When you find yourself writing foo.bar.bat a lot of times in the
>methods of the class of foo, it 
>is reasonable to consider foo.bar.bat a "close friend" of foo,
>so you introduce:
>    foo.bat = foo.bar.bat
>at an appropriate place, possibly in the __init__() method.
>This is more concise, and more efficient.
>It also reduces the need for get_bar_bat_baz() methods considerably.

Hmm, yes, I've been overlooking that. Looks like it might be a useful
technique in some parts of my current project. Thanks!

--PW



More information about the Python-list mailing list