bpo-31369: include RegexFlag in re.__all__ #30279
Conversation
|
|
||
| .. data:: NOFLAG | ||
|
|
||
| Indicates no flag being applied, the value is ``0``. |
There was a problem hiding this comment.
Similarly, explain when this is useful and add versionadded.
There was a problem hiding this comment.
It can be used for example as a default value for a function parameter, and also as a base value that will later conditionally be ORed with other flags. But this explanation would be confusing to many readers without code examples.
An example as follows may be enough:
def myfunc(text, flag=re.NOFLAG):
return re.match(text, flag)
What do you think?
There was a problem hiding this comment.
Thanks! I think that's a useful example.
There was a problem hiding this comment.
Not ignored, missed. It took place 11 years prior. We can certainly add a NOFLAGS name now, and make NOFLAG be an alias.
| "error", "Pattern", "Match", "A", "I", "L", "M", "S", "X", "U", | ||
| "ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE", | ||
| "UNICODE", | ||
| "UNICODE", "RegexFlag", |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
@ethanfurman would you like to look at this as it's enum-related? |
|
Thanks! I was just looking into this and was puzzled why a On a related note, I noticed that the type of |
|
|
||
| .. class:: RegexFlag | ||
|
|
||
| An :class:`~enum.Enum` class containing the regex options listed below. |
There was a problem hiding this comment.
What does the tilde in ~enum.Enum mean?
Also, it should be enum.IntFlag.
There was a problem hiding this comment.
The tilde creates a link with only the last element visible, i.e. Enum here, but since it should be IntFlag, I also removed the tilde as IntFlag is less known (though reader can still hover over shortened name to see where it links of course).
|
|
||
| An :class:`~enum.Enum` class containing the regex options listed below. | ||
|
|
||
| .. versionadded:: 3.6 (documented in 3.11) |
There was a problem hiding this comment.
Perhaps .. versionchanged:: added to all in 3.11
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
| An :class:`enum.IntFlag` class containing the regex options listed below. | ||
|
|
||
| .. versionadded:: 3.6 (documented in 3.11) | ||
| .. versionadded:: added to ``__all__`` in 3.11) |
There was a problem hiding this comment.
Missing a parenthesis, so lets change to:
.. versionadded:: 3.11 - added to ``__all__``
|
Stop
…On Sat, Feb 5, 2022, 12:03 AM Ethan Furman ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In Doc/library/re.rst
<#30279 (comment)>:
>
- .. versionadded:: 3.6 (documented in 3.11)
+ .. versionadded:: added to ``__all__`` in 3.11)
Missing a parenthesis, so lets change to:
.. versionadded:: 3.11 - added to ``__all__``
—
Reply to this email directly, view it on GitHub
<#30279 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AV5LH7EJ7NIFS3KIFCKMXF3UZRSNDANCNFSM5K3D7JFQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
@ethanfurman thanks for reviewing! |
https://bugs.python.org/issue31369