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

gh-105578: Add more usage examples to typing.AnyStr docs #107045

Merged
merged 5 commits into from Jul 31, 2023

Conversation

michael-the1
Copy link
Contributor

@michael-the1 michael-the1 commented Jul 22, 2023

Add more usage examples to typing.AnyStr.

In particular, contrast it with str | bytes, with examples of where one or the other would be used.


📚 Documentation preview 📚: https://cpython-previews--107045.org.readthedocs.build/

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Could you also add a note somewhere along the lines of:

Note that, despite its name, AnyStr has nothing to do with the Any type, nor does it mean "any string"

?

Doc/library/typing.rst Outdated Show resolved Hide resolved
Doc/library/typing.rst Outdated Show resolved Hide resolved
Doc/library/typing.rst Outdated Show resolved Hide resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Doc/library/typing.rst Outdated Show resolved Hide resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks great!

@AlexWaygood AlexWaygood changed the title gh-105578: Add more usage examples to typing.AnyStr gh-105578: Add more usage examples to typing.AnyStr docs Jul 31, 2023
@AlexWaygood AlexWaygood merged commit f877b32 into python:main Jul 31, 2023
22 checks passed
@miss-islington
Copy link
Contributor

Thanks @michael-the1 for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 31, 2023
…honGH-107045)

``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32)

Co-authored-by: Michael The <michael-the1@users.noreply.github.com>
@bedevere-bot
Copy link

GH-107503 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jul 31, 2023
@bedevere-bot
Copy link

GH-107504 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 31, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 31, 2023
…honGH-107045)

``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32)

Co-authored-by: Michael The <michael-the1@users.noreply.github.com>
AlexWaygood pushed a commit that referenced this pull request Jul 31, 2023
…-107045) (#107503)

gh-105578: Add more usage examples to `typing.AnyStr` docs (GH-107045)

``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32)

Co-authored-by: Michael The <michael-the1@users.noreply.github.com>
AlexWaygood pushed a commit that referenced this pull request Jul 31, 2023
…-107045) (#107504)

gh-105578: Add more usage examples to `typing.AnyStr` docs (GH-107045)

``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32)

Co-authored-by: Michael The <michael-the1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news topic-typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants