Re: Accessing container's methods

2015-12-08 Thread Chris Angelico
On Wed, Dec 9, 2015 at 10:41 AM, Ian Kelly wrote: > On Tue, Dec 8, 2015 at 3:37 PM, Erik wrote: >> On 08/12/15 19:02, Thomas 'PointedEars' Lahn wrote: >>> >>> Erik wrote: >>> >>> Please fix, Erik #75656. >> >> >> Fixed(*) > > [SNIP] > >> (*) In the sense that it's not going to change ;) > >

Re: Accessing container's methods

2015-12-08 Thread Ian Kelly
On Tue, Dec 8, 2015 at 3:37 PM, Erik wrote: > On 08/12/15 19:02, Thomas 'PointedEars' Lahn wrote: >> >> Erik wrote: >> >> Please fix, Erik #75656. > > > Fixed(*) [SNIP] > (*) In the sense that it's not going to change ;) Then I think you mean "Working as Intended", not "Fixed". B-) -- ht

Re: Accessing container's methods

2015-12-08 Thread Mark Lawrence
On 08/12/2015 22:52, Thomas 'PointedEars' Lahn wrote: Mark Lawrence wrote: On 08/12/2015 19:02, Thomas 'PointedEars' Lahn wrote: Erik wrote: Please fix, Erik #75656. Please fix what? You are not ready for the answer yet. I'll be all pointed ears when you actually manage to provide

Re: Accessing container's methods

2015-12-08 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote: > On 08/12/2015 19:02, Thomas 'PointedEars' Lahn wrote: >> Erik wrote: >> >> Please fix, Erik #75656. > > Please fix what? You are not ready for the answer yet. -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://ma

Re: Accessing container's methods

2015-12-08 Thread Thomas 'PointedEars' Lahn
Vincent Vande Vyvre wrote: > Le 08/12/2015 20:02, Thomas 'PointedEars' Lahn a écrit : >> Erik wrote: >>> Amongst other things, you can't put the object into multiple containers >> You can. Quickhack: ^ >> class Child: >> self._parents = [] >> >> def add_to_parent (s

Re: Accessing container's methods

2015-12-08 Thread Erik
Annoyingly, there seemed to be no responses to the original question when I wrote that and then shortly after, I saw all the others (and we all pretty much said the same thing - so I'm not sure why I was singled out for special attention ;)). On 08/12/15 19:02, Thomas 'PointedEars' Lahn wrote:

Re: Accessing container's methods

2015-12-08 Thread Mark Lawrence
On 08/12/2015 19:02, Thomas 'PointedEars' Lahn wrote: Erik wrote: Please fix, Erik #75656. Please fix what? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: Accessing container's methods

2015-12-08 Thread Vincent Vande Vyvre
Le 08/12/2015 20:02, Thomas 'PointedEars' Lahn a écrit : Erik wrote: Please fix, Erik #75656. On 07/12/15 18:10, Tony van der Hoff wrote: A highly contrived example, where I'm setting up an outer class in a Has-a relationship, containing a number of Actors. The inner class needs to access

Re: Accessing container's methods

2015-12-08 Thread Thomas 'PointedEars' Lahn
Erik wrote: Please fix, Erik #75656. > On 07/12/15 18:10, Tony van der Hoff wrote: >> A highly contrived example, where I'm setting up an outer class in a >> Has-a relationship, containing a number of Actors. The inner class needs >> to access a method of the outer class; here the method get_

Re: Accessing container's methods [solved]

2015-12-08 Thread Tony van der Hoff
Hum, sorry about the empty reply; just finger trouble! Anyway I wasn't expecting such a great response; thanks to all. On 07/12/15 23:47, Erik wrote: [snip] As you can't sensibly put the object into more than one container at a time anyway, then you can pass the container object to the Actor o

Re: Accessing container's methods

2015-12-08 Thread Tony van der Hoff
On 07/12/15 23:47, Erik wrote: Hi Tony, On 07/12/15 18:10, Tony van der Hoff wrote: A highly contrived example, where I'm setting up an outer class in a Has-a relationship, containing a number of Actors. The inner class needs to access a method of the outer class; here the method get_name. Ge

Re: Accessing container's methods

2015-12-07 Thread Erik
Hi Tony, On 07/12/15 18:10, Tony van der Hoff wrote: A highly contrived example, where I'm setting up an outer class in a Has-a relationship, containing a number of Actors. The inner class needs to access a method of the outer class; here the method get_name. Generally, an object should not ne

Re: Accessing container's methods

2015-12-07 Thread Chris Angelico
On Tue, Dec 8, 2015 at 8:38 AM, Terry Reedy wrote: >>def list_actors( self ): >> h=[] >> for n in self.actors: >>h.append( n.get_name() ) >> return h > > > return list(self.actors) # or perhaps even faster > return self.actors[:] Not identical semantics. This is a use-

Re: Accessing container's methods

2015-12-07 Thread Terry Reedy
On 12/7/2015 1:10 PM, Tony van der Hoff wrote: Hi, I have a class A, containing embedded embedded classes, which need to access methods from A. . A highly contrived example, where I'm setting up an outer class in a Has-a relationship, containing a number of Actors. The inner class needs to acces

Re: Accessing container's methods

2015-12-07 Thread Ian Kelly
On Mon, Dec 7, 2015 at 11:10 AM, Tony van der Hoff wrote: > Hi, > > I have a class A, containing embedded embedded classes, which need to access > methods from A. > . > A highly contrived example, where I'm setting up an outer class in a Has-a > relationship, containing a number of Actors. The inn

Re: Accessing container's methods

2015-12-07 Thread Thomas 'PointedEars' Lahn
Michael Torrie wrote: > On 12/07/2015 11:10 AM, Tony van der Hoff wrote: >> I have a class A, containing embedded embedded classes, which need to >> access methods from A. >> . >> A highly contrived example, where I'm setting up an outer class in a >> Has-a relationship, containing a number of Act

Re: Accessing container's methods

2015-12-07 Thread Peter Otten
Tony van der Hoff wrote: > Hi, > > I have a class A, containing embedded embedded classes, which need to > access methods from A. > . > A highly contrived example, where I'm setting up an outer class in a > Has-a relationship, containing a number of Actors. The inner class needs > to access a met

Re: Accessing container's methods

2015-12-07 Thread Thomas 'PointedEars' Lahn
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 constr

Re: Accessing container's methods

2015-12-07 Thread Michael Torrie
On 12/07/2015 11:10 AM, Tony van der Hoff wrote: > Hi, > > I have a class A, containing embedded embedded classes, which need to > access methods from A. > . > A highly contrived example, where I'm setting up an outer class in a > Has-a relationship, containing a number of Actors. The inner clas

Re: Accessing container's methods

2015-12-07 Thread Rob Gaddi
Tony van der Hoff wrote: > Hi, > > I have a class A, containing embedded embedded classes, which need to > access methods from A. > . > A highly contrived example, where I'm setting up an outer class in a > Has-a relationship, containing a number of Actors. The inner class needs > to access a m

Accessing container's methods

2015-12-07 Thread Tony van der Hoff
Hi, I have a class A, containing embedded embedded classes, which need to access methods from A. . A highly contrived example, where I'm setting up an outer class in a Has-a relationship, containing a number of Actors. The inner class needs to access a method of the outer class; here the meth