Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__repr__ of HamiltonNode is hard to read #865

Open
zilto opened this issue Apr 30, 2024 · 0 comments
Open

__repr__ of HamiltonNode is hard to read #865

zilto opened this issue Apr 30, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@zilto
Copy link
Collaborator

zilto commented Apr 30, 2024

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

[HamiltonNode("A", int), HamiltonNode("B", float), HamiltonNode("C", str)]
@zilto zilto added the enhancement New feature or request label Apr 30, 2024
@zilto zilto changed the title __repr__ of HamiltonNode doesn't meet Python standards. __repr__ of HamiltonNode is hard to read Apr 30, 2024
@zilto zilto self-assigned this May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant