Skip to content

Commit 7db1b00

Browse files
ENH: ADDS __REPR__ METHOD (#962)
* ENH: ADDS __REPR__ METHOD * ENH: Adds __repr__ method
1 parent a927248 commit 7db1b00

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

rocketpy/simulation/events.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,14 @@ def __verify_action(self, action):
154154
return action
155155

156156
def __repr__(self):
157-
# TODO: Implement a more informative string representation of the Event object.
158-
pass
157+
# .__self__ gets the Flight object
158+
# .__name__ gets the function name 'handle_out_of_rail_event'
159+
return (
160+
f"Event(name={self.name!r}, "
161+
f"trigger={self.trigger.__name__}, "
162+
f"action={self.action.__self__.__class__.__name__}.{self.action.__name__}, "
163+
f"event_context={self.event_context})"
164+
)
159165

160166
def __str__(self):
161167
# TODO: Implement a more informative string representation of the Event object.

0 commit comments

Comments
 (0)