propy.lookup_property¶
-
propy.
lookup_property
(name, lookup)[source]¶ Creates a class property that looks up data from a supplied dictionary. To use, place the method within the class’s scope.
Parameters: - name : str
The name of the property to be created.
- lookup : dict
The dictionary used for lookups.
Examples
>>> class Class(): ... LOOKUP_DICT = {'x': 1, 'y': 2, 'z': 3} ... property1 = lookup_property('property1', LOOKUP_DICT)