我一直在研究几种DLM,但大多数是用JAVA或C++编写的.似乎无法找到专门为.NET实现的任何服务.在.NET中分布式同步的任何想法或建议?
有没有办法使用__getattr__确定方法和属性调用之间的区别?
即:
class Bar(object):
def __getattr__(self, name):
if THIS_IS_A_METHOD_CALL:
# Handle method call
def method(**kwargs):
return 'foo'
return method
else:
# Handle attribute call
return 'bar'
foo=Bar()
print(foo.test_method()) # foo
print(foo.test_attribute) # bar
Run Code Online (Sandbox Code Playgroud)
这些方法不是本地的,因此无法使用getattr/callable来确定它.我也理解方法是属性,并且可能没有解决方案.只是希望有一个.