-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Ease initialization of reprlib.Repr attributes #94343
Labels
type-feature
A feature request or enhancement
Comments
My patch suggestion for 38,51c38,55
< def __init__(self):
< self.fillvalue = '...'
< self.maxlevel = 6
< self.maxtuple = 6
< self.maxlist = 6
< self.maxarray = 5
< self.maxdict = 4
< self.maxset = 6
< self.maxfrozenset = 6
< self.maxdeque = 6
< self.maxstring = 30
< self.maxlong = 40
< self.maxother = 30
---
> def __init__(
> self, fillvalue='...', maxlevel=6, maxtuple=6, maxlist=6, maxarray=5,
> maxdict=4, maxset=6, maxfrozenset=6, maxdeque=6, maxstring=30,
> maxlong=40, maxother=30,
> ):
> self.fillvalue = fillvalue
> self.maxlevel = maxlevel
> self.maxtuple = maxtuple
> self.maxlist = maxlist
> self.maxarray = maxarray
> self.maxdict = maxdict
> self.maxset = maxset
> self.maxfrozenset = maxfrozenset
> self.maxdeque = maxdeque
> self.maxstring = maxstring
> self.maxlong = maxlong
> self.maxother = maxanother However, it seems sensible to wait with the pull request if or until #92735 has been reviewed and (hopefully) merged. |
+1 This would be a nice improvement. Go ahead and submit a PR. There is no benefit to waiting on 92735 as it can easily be adapted. |
Thanks for the encouragement :)
Done |
rhettinger
pushed a commit
that referenced
this issue
Jul 7, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to use the
reprlib.Repr
class, currently, you need to instantiate an object and then set the desired attributes, afterwards, before you can actually use it:It might be more comfortable and clearer sometimes, to be able to set the attributes during the initialization:
Furthermore, this would make it possible to use
reprlib.Repr
without having to designate a permanent name:The text was updated successfully, but these errors were encountered: