-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
clean codeViolations against clean code principles.Violations against clean code principles.
Description
Some Graph properties are hard to compute but not always needed, like perfect_matchings. Therefore, we initialize them with a default string which says: This property is not ready, run getPerfectMatchings.
This nooby trick, which is also used in state_catalog and norm, should be replace by this suggestion from Matthias:
class Graph:
def __init__(self):
self._state_catalog = None
@property
def state_catalog(self):
if self._state_catalog is None:
self._compute_state_catalog()
return self._state_catalog
def _compute_state_catalog(self):
# Lengthy calculation here, setting self._state_catalog
Metadata
Metadata
Assignees
Labels
clean codeViolations against clean code principles.Violations against clean code principles.