Is it even possible?
The idea is that i want to have a special variable, that does some processing when assigning or getting its values. I also want it to look like a regular variable, so the dot notation is a problem here.
I know this is not really explicit, but that's what I need in order to try to replicate the Oz-esque Dataflow Variables.
If something like these style of dataflow variables was already implemented in a python library, please let me know.
Example:
class Promise(object):
def __init__(self):
self._value = 'defalt_value'
@property
def value(self):
#some processing/logic here
return self._value
@value.setter
def value(self, value):
#some processing/logic here
self._value = value
my_promise_obj = Promise()
my_promise = my_promise_obj.value
my_promise = 'Please, set my_promise_obj.value to this string'
print ('Object`s Value: ' + my_promise_obj.value)
print ('My Variable`s value: ' + my_promise)
print ('Has I changed the class attr?: ' + str(my_promise == my_promise_obj))