-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternative repr that does not look like it can be evaluated #41
Comments
btw, i can take a stab at a pr if you think this feature is worth adding. is seems that passing a flag to |
I agree but I’m not sure if it’s worth the complexity and confusion. Just because the |
that's why i suggested to have another flag to enable this "custom repr". it would be an independent flag (not dependent on |
I think I have an alternate solution that might satisfy this too. Adding some thoughts to a new issue (will link it in a sec). |
Solved by #568! |
not sure that's correct, @hynek. i opened this ticket about custom see the examples in the description of this issue; i don't think that can be achieved with #568. (tentatively reopening the ticket, feel free to close if things turn out to be different from what i wrote.) |
IIRC this ticket was about "Make |
the
repr()
generated byattrs
looks something like this by default:this is fine in simple cases. however, when using
init=False
, and implementing my own__init__()
, thisrepr()
is misleading since it looks like code that can be evaluated, while actually it is not (and if it is, it's not an intended usage pattern anyway). what about having something like this instead for those cases:...which is still very useful (e.g. for debugging), and it resembles a bit what python produces for classes that do not implement a custom
__repr__()
:obviously, this custom
repr()
behaviour would require explicit enabling. a flag toattr.s()
, e.g.attr.s(use_eval_repr=False)
(please come up with a better name), would make sense to me.what do you think?
The text was updated successfully, but these errors were encountered: