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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%rlooks OK to me. Is there a reason to use'%s'withtype(data).__name__?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use string tuples for
formatlike this?And then it would eliminate any possible confusion on the
%'s.If you are wondering why I prefer string tuples. It is because of the fact that it helps simplify a lot of code or on the other hand helps make the code confine to PEP8.
For example lets say you have this code with these objects:
Since both objects have the same attributes instead of doing an:
it could become:
As you can see simplifies things a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@berkerpeksag AFAIK
repring in error messages is used to play it safe in cases where the object happens to be an instance ofbytes; the__name__special attribute is always a string so%sis always certain to work. Apart from that, I followed along with other cases of formatting__name__I encountered in other error messages.@AraHaan The author of the module prefers using old-style formatting, so I stuck with that to keep it consistent. :-)