matsengrp/multidms

Property usage

wsdewitt opened this issue · 3 comments

In multidms.Data there are numerous @property definitions based on attributes with the following form, where the property with a name like attr() seems to only function as a way to publically expose a private attribute with a name like self._attr:

    @property
    def attr(self):
        """Docstring."""
        return self._attr

Maybe there's something I'm missing, but it seems like this could all be simplified by:

  1. change the attribute names to public (removing the underscore)
  2. remove the property wrappers
  3. document the newly-public attributes in the class docstring

@wsdewitt Properties by default are essentially getters for private attributes so they remain static/immutable. This provides exactly the behavior I want unless I'm missing something.

e.g. I want al those attributes exposed (without a function call), but the property makes it impossible to

data.attr = "I like hairy caterpillars"

Ah, ok. I agree this is the way to stop users from assigning to these attributes.