Conversation
__str__ for NpzFile object
e0eed41 to
a6f123d
Compare
|
@seberg is this what you had in mind? |
|
Something in this direction, maybe @rossbar has more opinions suggestions though. I really just thought that including the filename may be nice and that we should use |
__str__ for NpzFile object__repr__ for NpzFile object
seberg
left a comment
There was a problem hiding this comment.
Two small comments, otherwise I would be happy with this. To be clear, I am also happy to use a very different __repr__. For example, I am having second thoughts if there really is a reason for including the <> just because exec(repr) doesn't make sense.
rossbar
left a comment
There was a problem hiding this comment.
Thanks @ganesh-k13 this is a very nice usability improvement. I've added my own little nits but like @seberg no major blockers, though I do lean pretty strongly against adding another publicly-exposed parameter.
It'd also be nice to fix the keys() repr here, but that can also be saved for a separate PR!
19145be to
4b7ba5f
Compare
* Made ``MAX_REPR_ARRAY_COUNT`` private * Change repr string to make it more readable
|
@rossbar should we just give this a shot, or do you have any tweaking ideas for how to format the repr? |
rossbar
left a comment
There was a problem hiding this comment.
@ganesh-k13 I took the liberty of making two minor adjustments - I hope you don't mind!
- There was one remaining instance of the old-style
%sformatting - I managed to get rid of it by slightly modifying the logic in d8b97f5. - I also took the liberty of simplifying the test. My main goal was to remove the parameterization of the
_MAX_REPR_ARRAY_COUNTattribute, as this struck me as potentially problematic for niche testing setups, such as working with extensions likepytest-randomlyand/orpytest-xdist. Also - I don't know that we'd want to encourage users to modify that value, so leaving it out of the test parametrization seems desirable.
Hopefully neither of these changes is too disruptive, but please feel free to git reset if you want to discuss further! Other than that, LGTM thanks @ganesh-k13 . IMO this is a nice usability improvement 🚀
|
FWIW my suggestions broke the linter, but IMO the line that is 2 characters over the limit looks a lot better than splitting it up into multiple lines. Please feel free to reformat if you disagree! |
|
Thanks Ganesh and Ross for the input. I like the new repr, and if anyone has a good idea for improving it, I think improving the repr is fine to just follow up. |
Changes
Code:
Before:
Now:
Todo
resolves #23319