As others have pointed out, in order to do this, you'll need to keep a reference to the parent object around. Without questioning your reasons for wanting to do this, here's a possible solution:
class PropertyRef:
def __init__(self, obj, prop_name):
klass = obj.__class__
prop = getattr(klass, prop_name)
if not hasattr(prop, 'fget'):
raise TypeError('%s is not a property of %r' % (prop_name, klass))
self.get = lambda: prop.fget(obj)
if getattr(prop, 'fset'):
self.set = lambda value: prop.fset(obj, value))
class Foo(object):
@property
def bar(self):
return some_calculated_value
>>> foo_instance = Foo()
>>> ref = PropertyRef(foo_instance, 'bar')
>>> ref.get() # Returns some_calculated_value
>>> ref.set(some_other_value)
>>> ref.get() # Returns some_other_value
BTW, in the example you gave, the property is read-only (doesn't have a setter), so you wouldn't be able to set it anyway.
If this feels like an unnecessary amount of code, it probably is -- I'm almost certain you can find a better solution to your use case, whatever it is.