Skip to content
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

Merged
merged 1 commit into from May 31, 2019

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 7, 2019

@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Apr 7, 2019
M = MULTILINE
S = DOTALL
X = VERBOSE
ASCII = A = sre_compile.SRE_FLAG_ASCII # assume ascii "locale"
Copy link
Contributor

@SylvainDe SylvainDe Apr 13, 2019

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

Copy link
Member Author

@serhiy-storchaka serhiy-storchaka Apr 14, 2019

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.

Copy link
Member Author

@serhiy-storchaka serhiy-storchaka Apr 14, 2019

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__
Copy link
Contributor

@SylvainDe SylvainDe Apr 13, 2019

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 ?

@serhiy-storchaka serhiy-storchaka merged commit 14a0e16 into python:master May 31, 2019
@serhiy-storchaka serhiy-storchaka deleted the re-flags-repr branch May 31, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants