diff options
Diffstat (limited to 'netmodel/model/key.py')
-rw-r--r-- | netmodel/model/key.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/netmodel/model/key.py b/netmodel/model/key.py new file mode 100644 index 00000000..bc49af03 --- /dev/null +++ b/netmodel/model/key.py @@ -0,0 +1,19 @@ +from netmodel.model.mapper import ObjectSpecification + +class Key(ObjectSpecification): + def __init__(self, *attributes): + self._attributes = attributes + + #-------------------------------------------------------------------------- + # Descriptor protocol + # + # see. https://docs.python.org/3/howto/descriptor.html + #-------------------------------------------------------------------------- + + def __set_name__(self, owner, name): + self._name = name + self._owner = owner + + def __iter__(self): + for attribute in self._attributes: + yield attribute |