I am working on a Python concurrency framework (I know, YACF) and would like to be able to return variables as Futures, but without the user noticing it.
Right now I am doing:
x = someAsyncMethod(args)
print "Return value is %d" % x.get_value( )
Because the method return a Future object, but I would like it to be:
x = someAsyncMethod(args)
print "Return value is %d" % x
But still have the .get_value( ) of x invoked. Therefore I would like to Proxy wrap Python objects including int. Something like __get__, but so that if ProxyInt was a proxy for int and I did:
x = ProxyInt(10)
print x
or
n = x
My "__get__" method would be called and do some magic before doing "return 10"