You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Printing an HamiltonNode in the terminal or in a notebook cell returns node_name: node_type. While this is helpful, it has limitations.
it lacks quotation marks "node_name": "node_type" making it's difficult and unintuitive to read lists e.g., HamiltonGraph.nodes. You would get
[A: int, B: float, C: str]
it should declare it's Python type
Ideally, a __repr__ string is a string that you could copy-paste to instantiate the object e.g., HamiltonNode("node_name", ...). Given the lengthy declaration, I propose instead f"HamiltonNode("{self.name}", {self.type})"
For example
Printing an
HamiltonNode
in the terminal or in a notebook cell returnsnode_name: node_type
. While this is helpful, it has limitations."node_name": "node_type"
making it's difficult and unintuitive to read lists e.g.,HamiltonGraph.nodes
. You would getIdeally, a
__repr__
string is a string that you could copy-paste to instantiate the object e.g.,HamiltonNode("node_name", ...)
. Given the lengthy declaration, I propose insteadf"HamiltonNode("{self.name}", {self.type})"
For example
The text was updated successfully, but these errors were encountered: