As discussed in #185, I used namedtuple for the namespace.
Moreover, to make it constant, or immutable, I converted all the lists and dicts to tuples and MappingPrxoyTypes, respectively.
Since they become immutable, I decided to share a single namedtuple object across all the apps, by assigning it as an internal (protected) class attribute _constants.
For the access, BaseApp now provides a read-only propertyconstants.
Since the global constant namespace is independent to Qiwis object, the setter function set_global_constant_namespace() is defined in module-level.
For the naming convention of namedtuples, I mimicked the Python built-in type name styles, e.g., contextmanager, unittest, namedtuple, defaultdict, etc.
Now the setup.json can contain "constant" section as well.
This closes #185.
As discussed in #185, I used
namedtuple
for the namespace. Moreover, to make it constant, or immutable, I converted all thelist
s anddict
s totuple
s andMappingPrxoyType
s, respectively.Since they become immutable, I decided to share a single namedtuple object across all the apps, by assigning it as an internal (protected) class attribute
_constants
. For the access,BaseApp
now provides a read-only propertyconstants
.Since the global constant namespace is independent to
Qiwis
object, the setter functionset_global_constant_namespace()
is defined in module-level.For the naming convention of
namedtuple
s, I mimicked the Python built-in type name styles, e.g.,contextmanager
,unittest
,namedtuple
,defaultdict
, etc.Now the setup.json can contain "constant" section as well.