Closed systemcatch closed 3 years ago
Hello, I would like to implement this feature. It seems that currently, repr is "[class_name] + str". Can you be more specific with what additional data repr would need to have?
We should aim for a __repr__
similar to that of datetime
: https://stackoverflow.com/a/19597196/3820660.
How about this?
>>> repr(dt)
arrow.Arrow(2020, 7, 27, 22, 38, 46, 653869, tzinfo=tzutc())
@yiransii it might be better if @systemcatch takes this on since he has had a design in mind for the repr for a while.
We have decided not to proceed with this change.
Here are the current str and repr methods for Arrow.
__str__
should be human readable which I think is achieved, however__repr__
is designed for debugging and therefore needs to be explicit. It's also nice (but not required) if the__repr__
can be instantiated into a new object.This would be a breaking change so fits well for 1.0.0 if we decide to do it.