adds an extend API for the settings
This commit is contained in:
@ -10,8 +10,6 @@ Tiramisu is made of almost three main objects :
|
||||
- :class:`tiramisu.option.OptionDescription` is the shema, the option's structure
|
||||
- :class:`tiramisu.config.Config` which is the whole configuration entry point
|
||||
|
||||
.. image:: config.png
|
||||
|
||||
Accessing the `Option`'s
|
||||
-------------------------
|
||||
|
||||
@ -47,9 +45,13 @@ object is returned, and if no `Option` has been declared in the
|
||||
|
||||
The `Option` objects (in this case the :class:`~tiramisu.option.BoolOption`),
|
||||
are organized into a tree into nested
|
||||
:class:`~tiramisu.option.OptionDescription` objects. Every option has a name,
|
||||
as does every option group. The parts of the full name of the option are
|
||||
separated by dots: e.g. ``cfg.optgroup.optname``.
|
||||
:class:`~tiramisu.option.OptionDescription` objects.
|
||||
|
||||
.. image:: config.png
|
||||
|
||||
Every option has a name, as does every option group. The parts
|
||||
of the full name of the option are separated by dots: e.g.
|
||||
``cfg.optgroup.optname``.
|
||||
|
||||
Let's make the protocol of accessing a `Config`'s attribute explicit
|
||||
(because explicit is better than implicit):
|
||||
@ -362,6 +364,10 @@ read/write or read only mode::
|
||||
>>> c.cfgimpl_get_settings().remove('unknown')
|
||||
>>> print c.od1.var3
|
||||
value
|
||||
|
||||
Many properties can be defined at the same time on an option::
|
||||
|
||||
>>> c.cfgimpl_get_settings().extend(['unknown1', 'unknown2'])
|
||||
|
||||
Properties can also be defined on an option group (that is, on an
|
||||
:term:`option description`) let's hide a group and try to access to it::
|
||||
|
Reference in New Issue
Block a user