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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.