There probably is a name for what I'm asking for, perhaps it's best shown through an example. Suppose I have these classes:
class MonkeyCage(object):
def __init__(self, dimensions, monkeys=None):
self.dimensions = dimensions
self.monkeys = monkeys
def add_monkey(self, monkey):
self.monkeys.append(monkey)
class Monkey(object):
def __init__(self, name):
self.name = name
Suppose I create a zoo, with a MonkeyCage and a first Monkey:
>>> dimensions = {'width': 100, 'height': 200, 'depth': 70}
>>> cage = MonkeyCage(dimensions)
>>> monkey = Monkey("LaundroMat")
and add the monkey to the MonkeyCage:
>>> cage.add_monkey(monkey)
Is there a way -- via the monkey instance -- to get the dimensions of the cage the monkey was added to?