You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I discovered the __repr__ function in python. It seems that it would be useful implement this function such that objects can be recreated from log outputs.
Creating __repr__ for the class Polytope might be difficult if you want to include the memoized value of the bounding box because it (the attribute bbox) cannot be assigned by calling __init__.
Following the previous comment and to simplify __repr__, I suggest omitting all attributes that are computed automatically from other values. These comprise dependent information (for the sake of the argument only, we could imagine recomputing them with better precision on a future machine).
__repr__ is a useful mechanism, though I rarely use it. So, it would probably be good to implement this magic method only if someone uses it somewhere. The use case that seems more interesting is data persistence.
Recently I discovered the
__repr__
function in python. It seems that it would be useful implement this function such that objects can be recreated from log outputs.http://stackoverflow.com/a/19597196
The text was updated successfully, but these errors were encountered: