【文件属性】:
文件名称:Matlab树遍历代码-treacl:通过动态属性在python中创建树和图
文件大小:39KB
文件格式:ZIP
更新时间:2021-05-27 10:37:11
系统开源
Matlab树遍历代码目录
(README.org最好以原始或组织方式查看)
Treacl-利用使类实例的属性动态化的简单示例
介绍
Treacl是一个通用但非常简单的Python类,它支持利用动态属性来创建树和有向图。
在常规Python中,尽管将第一级属性动态添加到类的实例中(例如“
foo.aa
=
1”),但是当尝试多个级别(“
foo.aa.bb.cc
=
1”时,它将失败)
”)。
Treacl通过默认情况下启用此功能,默认情况下将使用新的空Treacl类实例作为值自动分配中间属性:
from
treacl
import
Treacl
foo
=
Treacl()
#
an
instance
of
the
class
Treacl
foo.xx
=
1
#
nothing
new,
just
default
Python
class
instance
behaviour
foo.aa.bb.cc.dd.ee
=
1
#
for
each
attribute
down
the
dot-path
expression
chain
except
the
last
(".ee"),
【文件预览】:
treacl-master
----README.md(10KB)
----utils()
--------treaclTest.py(116B)
--------util.py(3KB)
--------__init__.py(24B)
----README.org(9KB)
----tests()
--------yaml_test.ref(1KB)
--------table_test.ref(2KB)
--------standard_model_test.ref(1KB)
--------json_test.ref(1KB)
--------configuration_test.ref(5KB)
--------ssl_x509_cert_test.ref(12KB)
--------divide_by_7_test.ref(1KB)
--------xml_test.ref(649B)
--------universe_test.ref(14KB)
----examples()
--------table.py(4KB)
--------universe.py(2KB)
--------xml.py(1KB)
--------configuration.py(2KB)
--------standard_model_prop.py(5KB)
--------json.py(2KB)
--------ssl_x509_cert.py(17KB)
--------divide_by_7.py(4KB)
--------standard_model.py(5KB)
--------yaml.py(2KB)
--------quantlib_instruments_hierarchy.py(891B)
----tests.py(1KB)
----treacl.py(15KB)
----__init__.py(217B)