Repository navigation
fix: __repr__ use collection subclass name - #3219
Merged
youknowone merged 1 commit intoOct 6, 2021
Merged
Conversation
youknowone
reviewed
Oct 4, 2021
muscar
force-pushed
the
fix/repr-use-collection-subclass-name
branch
from
October 6, 2021 08:05
a9c1144 to
f5dc0b4
Compare
Addresses: RustPython#3217 This patch changes the `set`, `frozenset`, `deque` and `bytearray` collections to use the subclass name in `__repr__`, if they are subclassed.
muscar
force-pushed
the
fix/repr-use-collection-subclass-name
branch
from
October 6, 2021 09:01
f5dc0b4 to
cd42160
Compare
youknowone
reviewed
Oct 6, 2021
Comment on lines
+207
to
+211
| let inner_repr = format!("{{{}}}", str_parts.join(", ")); | ||
| if let Some(name) = class_name { | ||
| return Ok(format!("{}({})", name, inner_repr)); | ||
| }; | ||
| Ok(inner_repr) |
Member
There was a problem hiding this comment.
still double formatting when class_name is Some
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses: #3217
This patch changes the
set,frozenset,dequeandbytearraycollections to use the subclass name in
__repr__, if they aresubclassed.