Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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"

?

@AlexWaygood AlexWaygood added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jul 23, 2023
@michael-the1 michael-the1 requested a review from AlexWaygood July 25, 2023 20:53
@michael-the1 michael-the1 requested a review from AlexWaygood July 30, 2023 16:03
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
@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 <[email protected]>
@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 only 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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.

5 participants