DefinitionProperty

class ipkiss3.all.DefinitionProperty

DefinitionProperty is one of the most frequently used property types. If your class has a _default_<name> method, with <name> the name of your property, the result of this method will be used as the default.

A DefinitionProperty should always be an attribute of a class that inherits (directly or indirectly) from StrongPropertyInitializer.

Parameters:
default:

The default value of the property, can be a function as well.

allow_none: bool, optional

If True, the property’s value can be None

restriction: optional

If you assign a restriction to the DefinitionProperty, ipkiss will enforce that a assigned value complies with the restriction.

locked: bool, optional

If locked is True, the property is readonly, once you’ve assigned a value, you can’t assign a new value to it.

fdef_name: str, optional

Allows you to choose a different method as the _default_* method

cache_invalidation: bool, optional, default = True

If set True (default), the cached value of this property will be flagged as ‘dirty’ whenever another property is set or a depencency changes. When set False, this will not happen; so generally this property will only be calculated once.

doc: str, optional

A docstring explaining the meaning of the property.

Notes

You should take care when overridding properties, the following for example will not work:

class A(StrongPropertyInitializer):

    char = DefinitionProperty(default='a')

class B(A):

    char = 'b'  # this will not work
doc
preprocess
allow_none
restriction
fdef_name
default_config_proxy
default