diff --git a/pybis/src/python/pybis/property.py b/pybis/src/python/pybis/property.py index d1866a27a7f0bb8b48567a29581b3a8290ec2981..8bd83a36fe054a3235d6999d0fd8e2ab7b28086b 100644 --- a/pybis/src/python/pybis/property.py +++ b/pybis/src/python/pybis/property.py @@ -50,6 +50,16 @@ class PropertyHolder(): props[code] = value return props + def __call__(self, prop, val=None): + """Yet another way to set/get the values to a property: + sample.props('$name', 'new value') + sample.props('$name') # returns 'new value' + """ + if val is None: + return getattr(self, prop) + else: + setattr(self, prop, val) + def __getitem__(self, key): """For properties that contain either a dot or a dash or any other non-valid method character, a user can use a key-lookup instead, e.g. sample.props['my-weird.property-name']