bartongroup / slivka

http://bartongroup.github.io/slivka/
Apache License 2.0
7 stars 3 forks source link

Implement array fields as mixins #94

Closed warownia1 closed 3 years ago

warownia1 commented 3 years ago

We can utilize Python's multiple inheritance and mixin classes to "convert" any field class to it's array counterpart instead of having multiple flag. The mixin would override validate() and to_cmd_parameter to work with arrays and call superclass' methods on individual values i.e.

def validate(self, value):
    return list(map(super().validate, value))

This should improve code readability and testability.