Skip to content

Commit

Permalink
Improve docs for abstractproperty
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfellows committed Mar 29, 2023
1 parent a79d01a commit be785d6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spinn_utilities/abstract_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ class C(object, metaclass=AbstractBase):
def getx(self): ...
def setx(self, value): ...
x = abstractproperty(getx, setx)
.. note::
When documenting abstract properties, remember to document them as if
they are nouns, not verbs; they are things about the object that may
be observed as many times as the user of the class desires.
.. warning::
Implementations should be idempotent; fetching the property twice in a
row should get an equivalent value with no (meaningful) change to the
state of the object (assuming no other non-property methods of the
object are invoked between).
This is an assumption that debuggers make. *Do not violate it!*
"""
__isabstractmethod__ = True

Expand Down

0 comments on commit be785d6

Please sign in to comment.