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
bpo-36548: Improve the repr of re flags. #12715
bpo-36548: Improve the repr of re flags. #12715
Conversation
M = MULTILINE | ||
S = DOTALL | ||
X = VERBOSE | ||
ASCII = A = sre_compile.SRE_FLAG_ASCII # assume ascii "locale" |
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.
Not related to the issue you are solving (but as you're updating this code anyway):
- the alignment may be more aesthetically pleasing if the one latter variable was the first here
- PEP8 recommends using at least 2 whitespace before the inline comment
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.
In case of aliases the canonical name is the one that is defined first. We want to use long names.
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.
Some lines are already too long, and using two spaces will make them even longer.
else: | ||
res = f'~{res}' | ||
return res | ||
__str__ = object.__str__ |
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.
As you're adding this line, would it be worth adding a few test cases for it ?
https://bugs.python.org/issue36548