Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100100

Re: Accessing container's methods

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.python
Subject Re: Accessing container's methods
Date 2015-12-07 19:46 +0100
Organization PointedEars Software (PES)
Message-ID <90599474.m2LfGONAbA@PointedEars.de> (permalink)
References <dcm0c2Fi2ktU1@mid.individual.net>

Show all headers | View raw


Tony van der Hoff wrote:

> I have a class A, containing embedded embedded classes, which need to
> access methods from A.

Let the name of the "embedded class" (which is not embedded at all in your 
example code) be E.  You could either store the information in the E 
instance upon or after construction, or you could pass a reference to the A 
instance to the E instance’s method, so that you can call the A instance’s 
public methods from the E instance’s methods.

But consider the Law of Demeter.

> I don't really want to make Actor a sub-class (is-a; it isn't) of Monty;
> that would raise all sorts of other problems.

It would simply be wrong.  Monty (Python) is (literally) a group of Actors.
 
-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing container's methods Tony van der Hoff <tony@vanderhoff.org> - 2015-12-07 18:10 +0000
  Re: Accessing container's methods Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2015-12-07 18:21 +0000
  Re: Accessing container's methods Michael Torrie <torriem@gmail.com> - 2015-12-07 11:36 -0700
    Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-07 20:03 +0100
  Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-07 19:46 +0100
  Re: Accessing container's methods Peter Otten <__peter__@web.de> - 2015-12-07 19:59 +0100
  Re: Accessing container's methods Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-07 12:33 -0700
  Re: Accessing container's methods Terry Reedy <tjreedy@udel.edu> - 2015-12-07 16:38 -0500
  Re: Accessing container's methods Chris Angelico <rosuav@gmail.com> - 2015-12-08 09:02 +1100
  Re: Accessing container's methods Erik <python@lucidity.plus.com> - 2015-12-07 23:47 +0000
    Re: Accessing container's methods Tony van der Hoff <tony@vanderhoff.org> - 2015-12-08 12:35 +0000
    Re: Accessing container's methods [solved] Tony van der Hoff <tony@vanderhoff.org> - 2015-12-08 13:46 +0000
    Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-08 20:02 +0100
      Re: Accessing container's methods Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2015-12-08 20:54 +0100
        Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-08 23:51 +0100
      Re: Accessing container's methods Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-08 20:30 +0000
        Re: Accessing container's methods Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-08 23:52 +0100
          Re: Accessing container's methods Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-08 22:59 +0000
      Re: Accessing container's methods Erik <python@lucidity.plus.com> - 2015-12-08 22:37 +0000
      Re: Accessing container's methods Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-08 16:41 -0700
      Re: Accessing container's methods Chris Angelico <rosuav@gmail.com> - 2015-12-09 12:04 +1100

csiph-web