The BaseDataObject ABC

The bulk of the properties of BaseDataObject are Boolean values, flags that indicate whether an instance of the class is in a specific state. The implementations of those properties all follow a simple pattern that's already been shown in the definition of the  available property of BaseProduct in the previous iteration. That structure looks like this:

################################### # Property-getter methods # ################################### def _get_bool_prop(self) -> (bool,): return self._bool_prop ################################### # Property-setter methods # ################################### def _set_bool_prop(self, value:(bool,int)): if value not in (True, False, 1, 0): raise ValueError( '%s.bool_prop ...

Get Hands-On Software Engineering with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.