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-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar by fofoni · Pull Request #126584 · python/cpython

Conversation

@fofoni

@fofoni fofoni commented Nov 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

I only changed instances of "bound" when they were being used as an adjective. I left other instances as they were:

  1. Of course, instances of bound-as-in-binding were not touched.

  2. The docs for the TypeVar.__bound__ attribute use the word "bound" as a noun. I thought about changing it to "boundary" or "boundary type", but gave up because there is also a TypeVar.evaluate_bound method, so "bound" as a noun is kind of set in stone. One other possibility (which I believe would be a positive change) is to change "bound" to "upper bound" here, i.e.:

        .. attribute:: __bound__
     
    -      The bound of the type variable, if any.
    +      The upper bound of the type variable, if any.
     
           .. versionchanged:: 3.12
     
              For type variables created through :ref:`type parameter syntax <type-params>`,
              the bound is evaluated only when the attribute is accessed, not when
              the type variable is created (see :ref:`lazy-evaluation`).

    (I think the "bound" inside the versionchanged block is fine, I wouldn't touch it.)

  3. The docs for ParamSpec also use "bound" as a noun, like this:

    Without ParamSpec, the simplest way to annotate this previously was to use a TypeVar with bound Callable[..., Any].

    I also though about changing it to "... a TypeVar bounded by ...", but I don't think it's necessary (though I also don't think it would be a negative change). If we end up changing "bound" to "upper bound" in the item above, then maybe the same should be done here. (But note that the expression "upper bound" does not currently appear in this document.)

  • Issue: The docs for the typing stdlib module use the phrase "bound type var" to mean two distinct things #126543

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@fofoni
Change "bound type var" to "bounded" in docs
40efa4e
@fofoni
fofoni requested review from AlexWaygood and JelleZijlstra as code owners November 8, 2024 14:30
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Nov 8, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Nov 8, 2024
The docs for the typing stdlib module use the phrase "bound type var" to mean two distinct things #126543
Closed
@JelleZijlstra

JelleZijlstra commented Nov 8, 2024

Copy link
Copy Markdown
Member

The name "evaluate_bound" isn't set in stone; it was added during the 3.14 alphas and does not yet have any compatibility constraints. However, I think it should match the bound= argument to the TypeVar constructor and the __bound__ attribute, so I wouldn't support changing the name.

Using "upper bound" instead of "bound" in the documentation seems like a good idea.

fofoni reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood

AlexWaygood commented Nov 8, 2024

Copy link
Copy Markdown
Member

Using "upper bound" instead of "bound" in the documentation seems like a good idea.

Agreed!

All reactions

Sorry, something went wrong.

Uh oh!

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

AlexWaygood
AlexWaygood reviewed Nov 8, 2024
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.

Thanks for this!

Sorry, something went wrong.

Uh oh!

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

All reactions
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.

fofoni added 2 commits November 8, 2024 12:50
@fofoni
Rewording suggestions
0297395
@fofoni
Change "bound" as a noun to "upper bound"
fa0e3bd
@fofoni

fofoni commented Nov 8, 2024

Copy link
Copy Markdown
Contributor Author

There. I also changed the two instances of "bound" as noun to "upper bound", as mentioned in the OP.

I still feel that the expressions "bounded" and "upper bound" may appear disconnected. Maybe the similarity of the words is enough to imply that the expressions are talking about the same thing, but maybe it's not clear for a reader not used to typing -- I'm really not sure. (Also, maybe it's just that English is not my native language.)

Currently, the first time both expressions appear is in the following snippet. Perhaps adding just this small note would be enough?

   This syntax can also be used to create bounded and constrained type
   variables::

      class StrSequence[S: str]:  # S is a TypeVar with a `str` upper bound
-          ...
+          ...                    # We also say that S is bounded by str


      class StrOrBytesSequence[A: (str, bytes)]:  # A is a TypeVar constrained to str or bytes
          ...
All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood

AlexWaygood commented Nov 8, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Currently, the first time both expressions appear is in the following snippet. Perhaps adding just this small note would be enough?

   This syntax can also be used to create bounded and constrained type
   variables::

      class StrSequence[S: str]:  # S is a TypeVar with a `str` upper bound
-          ...
+          ...                    # We also say that S is bounded by str


      class StrOrBytesSequence[A: (str, bytes)]:  # A is a TypeVar constrained to str or bytes
          ...

That seems reasonable to me! Or maybe

   This syntax can also be used to create bounded and constrained type
   variables::

-      class StrSequence[S: str]:  # S is a TypeVar with a `str` upper bound
-          ...
+      class StrSequence[S: str]:  # S is a TypeVar with a `str` upper bound;
+          ...                     # we can say that S is "bounded by `str`"


      class StrOrBytesSequence[A: (str, bytes)]:  # A is a TypeVar constrained to str or bytes
          ...
fofoni reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood AlexWaygood added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Nov 8, 2024
@fofoni
Note that "bounded" and "upper bound" refer to the same thing
673a71b
AlexWaygood
AlexWaygood approved these changes Nov 8, 2024
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!

Sorry, something went wrong.

Uh oh!

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

fofoni reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Nov 8, 2024
@fofoni

fofoni commented Nov 8, 2024

Copy link
Copy Markdown
Contributor Author

I think I'm happy with it! Do I need to do anything else?

Thank you all for the very fast iteration!

All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood

AlexWaygood commented Nov 8, 2024

Copy link
Copy Markdown
Member

I think I'm happy with it! Do I need to do anything else?

Not from my perspective! I'll wait a little while before merging, though, in case @JelleZijlstra or anybody else has any comments (there was quite a bit of discussion on the issue!)

All reactions

Sorry, something went wrong.

Uh oh!

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

ruidazeng
ruidazeng approved these changes Nov 10, 2024
View reviewed changes
JelleZijlstra
JelleZijlstra reviewed Nov 10, 2024
View reviewed changes
Comment thread Doc/library/typing.rst Resolved

Uh oh!

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

@fofoni @JelleZijlstra
Typo
daf3fe1
Co-authored-by: Jelle Zijlstra <[email protected]>
@ghost

ghost commented Nov 10, 2024 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@fofoni

fofoni commented Nov 10, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

Oh wow I used GitHub's "accept suggestion" button, and now it created a commit with a different email address. Do I really need to sign the CLA again? Can I force-push changing that to my email address that had already signed the CLA?

EDIT: I guess it doesn't hurt to have the CLA signed from multiple addresses. Please tell me if having multiple addresses in the commit list is not desirable for any reason.

All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood

AlexWaygood commented Nov 10, 2024

Copy link
Copy Markdown
Member

Oh wow I used GitHub's "accept suggestion" button, and now it created a commit with a different email address. Do I really need to sign the CLA again? Can I force-push changing that to my email address that had already signed the CLA?

EDIT: I guess it doesn't hurt to have the CLA signed from multiple addresses. Please tell me if having multiple addresses in the commit list is not desirable for any reason.

I'm pretty sure that should be fine :-)

fofoni reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@JelleZijlstra
JelleZijlstra merged commit 434b297 into python:main Nov 11, 2024
@miss-islington-app

miss-islington-app Bot commented Nov 11, 2024

Copy link
Copy Markdown

Thanks @fofoni for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 11, 2024
@JelleZijlstra

JelleZijlstra commented Nov 11, 2024

Copy link
Copy Markdown
Member

No worries! We squash-merge so it doesn't really matter.

All reactions

Sorry, something went wrong.

Uh oh!

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 11, 2024
@fofoni @miss-islington
pythongh-126543: Docs: change "bound type var" to "bounded" when used…
14ef1dd
… in the context of the 'bound' kw argument to TypeVar (pythonGH-126584)

(cherry picked from commit 434b297)

Co-authored-by: Pedro Fonini <[email protected]>
@bedevere-app

bedevere-app Bot commented Nov 11, 2024

Copy link
Copy Markdown

GH-126657 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Nov 11, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 11, 2024
@fofoni @miss-islington
pythongh-126543: Docs: change "bound type var" to "bounded" when used…
fe4e357
… in the context of the 'bound' kw argument to TypeVar (pythonGH-126584)

(cherry picked from commit 434b297)

Co-authored-by: Pedro Fonini <[email protected]>
@bedevere-app

bedevere-app Bot commented Nov 11, 2024

Copy link
Copy Markdown

GH-126658 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-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Nov 11, 2024
JelleZijlstra pushed a commit that referenced this pull request Nov 11, 2024
@miss-islington @fofoni
[3.13] gh-126543: Docs: change "bound type var" to "bounded" when use…
3d8f549
…d in the context of the 'bound' kw argument to TypeVar (GH-126584) (#126657)


(cherry picked from commit 434b297)

Co-authored-by: Pedro Fonini <[email protected]>
JelleZijlstra pushed a commit that referenced this pull request Nov 11, 2024
@miss-islington @fofoni
[3.12] gh-126543: Docs: change "bound type var" to "bounded" when use…
55c5305
…d in the context of the 'bound' kw argument to TypeVar (GH-126584) (#126658)


(cherry picked from commit 434b297)

Co-authored-by: Pedro Fonini <[email protected]>
picnixz pushed a commit to picnixz/cpython that referenced this pull request Dec 8, 2024
@fofoni @picnixz
pythongh-126543: Docs: change "bound type var" to "bounded" when used…
2eab16a
… in the context of the 'bound' kw argument to TypeVar (python#126584)
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
@fofoni @ebonnal
pythongh-126543: Docs: change "bound type var" to "bounded" when used…
2fcdddd
… in the context of the 'bound' kw argument to TypeVar (python#126584)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra left review comments
@AlexWaygood AlexWaygood AlexWaygood approved these changes
+1 more reviewer
@ruidazeng ruidazeng ruidazeng approved these changes
Reviewers whose approvals may not affect merge requirements

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

Projects

Docs PRs
Status: Done

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.

4 participants

@fofoni @JelleZijlstra @AlexWaygood @ruidazeng
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 01402503 — 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.