Re: object knows which object called it?

2009-04-07 Thread afriere
On Apr 7, 2:53 am, "R. David Murray" wrote: > I think the OO way to do this is to provide a method on A that does the > right thing: > >     def Bfoo_func(self): >         self.B.foo_func(self) > > Or maybe you could look at generic methods, which provide a way > to do multiple dispatch. +1 Whic

Re: object knows which object called it?

2009-04-07 Thread Ricardo Aráoz
Reckoner wrote: >> hi, >> >> I have the following problem: I have two objects, say, A and B, which >> are both legitimate stand-alone objects with lives of their own. >> >> A contains B as a property, so I often do >> >> A.B.foo() >> >> the problem is that some functions inside of B actually need A

Re: object knows which object called it?

2009-04-06 Thread Steven D'Aprano
On Mon, 06 Apr 2009 07:53:55 -0700, Reckoner wrote: > hi, > > I have the following problem: I have two objects, say, A and B, which > are both legitimate stand-alone objects with lives of their own. > > A contains B as a property, so I often do > > A.B.foo() > > the problem is that some functi

Re: object knows which object called it?

2009-04-06 Thread George Sakkis
On Apr 6, 10:53 am, Reckoner wrote: > hi, > > I have the following problem: I have two objects, say, A and B, which > are both legitimate stand-alone objects with lives of their own. > > A contains B as a property, so I often do > > A.B.foo() > > the problem is that some functions inside of B actu

Re: object knows which object called it?

2009-04-06 Thread Anthra Norell
Reckoner wrote: hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually need A (remember I said they w

Re: object knows which object called it?

2009-04-06 Thread Duncan Booth
Reckoner wrote: > hi, > > I have the following problem: I have two objects, say, A and B, which > are both legitimate stand-alone objects with lives of their own. > > A contains B as a property, so I often do > > A.B.foo() > > the problem is that some functions inside of B actually need A > (

Re: object knows which object called it?

2009-04-06 Thread Aaron Brady
On Apr 6, 9:53 am, Reckoner wrote: > hi, > > I have the following problem: I have two objects, say, A and B, which > are both legitimate stand-alone objects with lives of their own. > > A contains B as a property, so I often do > > A.B.foo() > > the problem is that some functions inside of B actua

object knows which object called it?

2009-04-06 Thread R. David Murray
Reckoner wrote: > hi, > > I have the following problem: I have two objects, say, A and B, which > are both legitimate stand-alone objects with lives of their own. > > A contains B as a property, so I often do > > A.B.foo() > > the problem is that some functions inside of B actually need A > (r

object knows which object called it?

2009-04-06 Thread Reckoner
hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually need A (remember I said they were both standalon