Skip to content

Commit

Permalink
Change the __str__ and __repr__ method of DynamicNode to be more clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
ankurankan committed Aug 3, 2021
1 parent 91f753a commit 7b691d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pgmpy/models/DynamicBayesianNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def __getitem__(self, idx: int) -> typing.Union[str, int]:
raise IndexError(f"Index {idx} out of bounds.")

def __str__(self) -> str:
return f"{self.node}_{self.time_slice}"
return f"({self.node}, {self.time_slice})"

__repr__ = __str__
def __repr__(self) -> str:
return f"<DiscreteNode({self.node}, {self.time_slice}) at {hex(id(self))}>"

def __lt__(self, other) -> bool:
if self.node < other.node:
Expand Down

0 comments on commit 7b691d2

Please sign in to comment.