RestrictValueList

class ipkiss3.all.RestrictValueList

restrict the argument to a list of allowed values

Parameters:
allowed_values: tuple, list

A tuple of allowed values

Examples

import ipkiss3.all as i3

class Example(i3.StrongPropertyInitializer):

    num_prop = i3.DefinitionProperty(restriction=i3.RestrictValueList((2, 4, 'str')))

example1 = Example(num_prop=2) # this is ok
example2 = Example(num_prop='str') # this is ok as well
example3 = Example(num_prop=1) # this will fail
allowed_values