On Sun, Aug 18, 2013 at 12:40 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > The Law of Demeter is really about being careful about what interface > your classes provide. Customers should provide a get_payment method; dogs > should provide a walk method. You shouldn't have to send individual step > messages to the dog's legs.
And it has its limits, too. If you're walking a dog on a leash, you don't send a message to the leash to send a message to the dog to walk. You talk directly to the dog. Like most programming principles, it's something to read, to grok, and then to think about. I have yet to find any rule which, if slavishly followed, will not lead to bad code _somewhere_. ChrisA -- http://mail.python.org/mailman/listinfo/python-list