【文件属性】:
文件名称:委托:python3装饰器,方法代理,属性代理,用于将任务委托给子对象
文件大小:19KB
文件格式:ZIP
更新时间:2021-02-15 12:58:56
Python
委托
Python3类,用于将任务委托给下级对象。
通过装饰器,赋值或自动类嵌入为方法或属性创建代理。
下属可以是现有对象,也可以是要动态检索的实例//类属性的名称。
样品用法
class Master(object):
# Delegate explicitly
attr1, ..., attr99 = delegated.tasks(sub, 'attr1, ..., attr99') # the subordinate can be an existing object
method1, ..., method99 = delegated.tasks('sub', 'method1, ..., method99') # OR a string to use dynamic discovery
# Delegate implicitly
【文件预览】:
delegated-master
----MANIFEST.in(33B)
----tests()
--------test_delegated.py(12KB)
----LICENSE(34KB)
----__init__.py(0B)
----setup.py(3KB)
----.gitignore(1KB)
----delegated.py(7KB)
----README.md(2KB)