Context:
As stated in #20 the __repr__() methods are currently used for serialization. This is not ideal, since we don't really want serialization to happen each time __repr__() is called. Instead that method should return a brief representation of the object.
Description of the Change:
All current __repr__() methods are renamed __str__() so that the serialization is done by calling str() instead. This was mentioned as a potential solution in the linked issue.
Each function now has a new __repr__() method that, when called, returns a nice representation of the object.
Benefits:__repr__() works as expected.
Possible Drawbacks:
Whether the __str__() solution is the best solution is still up for discussion. Another suggestion would be to create a serialize() method (see #20 for further details)
Context: As stated in #20 the
__repr__()
methods are currently used for serialization. This is not ideal, since we don't really want serialization to happen each time__repr__()
is called. Instead that method should return a brief representation of the object.Description of the Change:
__repr__()
methods are renamed__str__()
so that the serialization is done by callingstr()
instead. This was mentioned as a potential solution in the linked issue.__repr__()
method that, when called, returns a nice representation of the object.Benefits:
__repr__()
works as expected.Possible Drawbacks: Whether the
__str__()
solution is the best solution is still up for discussion. Another suggestion would be to create aserialize()
method (see #20 for further details)Related GitHub Issues:
20