GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-105578: Add more usage examples to `typing.AnyStr` docs by michael-the1 · Pull Request #107045 · python/cpython

Conversation

@michael-the1

@michael-the1 michael-the1 commented Jul 22, 2023 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

  • Issue: Discourage and deprecate typing.AnyStr #105578

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@michael-the1
Add more usage examples to typing.AnyStr
a3be84b
@michael-the1
michael-the1 requested review from AlexWaygood, Fidget-Spinner, JelleZijlstra and gvanrossum as code owners July 22, 2023 14:58
@bedevere-bot bedevere-bot mentioned this pull request Jul 22, 2023
Discourage and deprecate typing.AnyStr #105578
Closed
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Jul 22, 2023
AlexWaygood
AlexWaygood reviewed Jul 22, 2023
View reviewed changes

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

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.

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"

?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michael-the1 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood AlexWaygood added the topic-typing label Jul 22, 2023
JelleZijlstra
JelleZijlstra reviewed Jul 23, 2023
View reviewed changes
Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@michael-the1
Clarify extra examples
202b372
@michael-the1
michael-the1 requested review from AlexWaygood and JelleZijlstra July 23, 2023 09:42
@AlexWaygood AlexWaygood added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jul 23, 2023
AlexWaygood
AlexWaygood reviewed Jul 23, 2023
View reviewed changes
Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@michael-the1 @AlexWaygood
Improve comments surrounding new AnyStr examples
1fa3471
Co-authored-by: Alex Waygood <[email protected]>
@michael-the1
michael-the1 requested a review from AlexWaygood July 25, 2023 20:53
@AlexWaygood
stray "OK" comment
78e7254
AlexWaygood
AlexWaygood reviewed Jul 26, 2023
View reviewed changes
Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@michael-the1 @AlexWaygood
Remove sentence in AnyStr docs
2cb6a5f
Co-authored-by: Alex Waygood <[email protected]>
@michael-the1
michael-the1 requested a review from AlexWaygood July 30, 2023 16:03
AlexWaygood
AlexWaygood approved these changes Jul 31, 2023
View reviewed changes

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

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.

Thank you, looks great!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Jul 31, 2023
@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

miss-islington commented Jul 31, 2023

Copy link
Copy Markdown
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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Jul 31, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 31, 2023
@michael-the1 @miss-islington
pythongh-105578: Add more usage examples to typing.AnyStr docs (pyt…
ec30258
…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

bedevere-bot commented Jul 31, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Jul 31, 2023
@bedevere-bot

bedevere-bot commented Jul 31, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@michael-the1 @miss-islington
pythongh-105578: Add more usage examples to typing.AnyStr docs (pyt…
79af765
…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
@miss-islington @michael-the1
[3.12] gh-105578: Add more usage examples to typing.AnyStr docs (GH…
9f58d9e
…-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
@miss-islington @michael-the1
[3.11] gh-105578: Add more usage examples to typing.AnyStr docs (GH…
3de42bb
…-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

Reviewers

@AlexWaygood AlexWaygood AlexWaygood approved these changes
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner
@JelleZijlstra JelleZijlstra Awaiting requested review from JelleZijlstra JelleZijlstra is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news topic-typing

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@michael-the1 @miss-islington @bedevere-bot @JelleZijlstra @AlexWaygood
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.