object knows which object called it?
george.sakkis at gmail.com
Mon Apr 6 21:55:17 CEST 2009
On Apr 6, 10:53 am, Reckoner <recko... at gmail.com> wrote:
> 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
> the problem is that some functions inside of B actually need A
> (remember I said they were both standalone objects), so I have to
> often do:
> Which is kind of awkward.
> Is there some way that B.foo_func() could somehow know that it was
> called as a property of A in this way?
> Note that I'm looking for the calling object and NOT the calling
Read up on descriptors , it seems that's what you're looking for.
More information about the Python-list