Skip to content

gh-82406: document duck-type nature of inspect.is*function - #94987

Merged
encukou merged 10 commits into
python:mainfrom
graingert:document-duck-type-is-star-function
Sep 3, 2026
Merged

gh-82406: document duck-type nature of inspect.is*function#94987
encukou merged 10 commits into
python:mainfrom
graingert:document-duck-type-is-star-function

Conversation

@graingert

@graingert graingert commented Jul 18, 2022

Copy link
Copy Markdown
Contributor

Comment thread Doc/library/inspect.rst
Comment thread Lib/inspect.py Outdated
@graingert
graingert force-pushed the document-duck-type-is-star-function branch from ed1273f to c8fafc0 Compare July 18, 2022 20:59
@graingert
graingert force-pushed the document-duck-type-is-star-function branch from f722790 to 3c3d198 Compare July 18, 2022 21:01
@encukou encukou added the docs Documentation in the Doc dir label Mar 28, 2024
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 11, 2026
@read-the-docs-community

read-the-docs-community Bot commented Sep 2, 2026

Copy link
Copy Markdown

@johnslavik johnslavik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider different wording, not "duck-type functions".
Maybe function-like objects? I've seen that a couple times in the docs. If we go the duck-type path, maybe link to the glossary (:term:`duck-typing`​)?

Comment thread Doc/library/inspect.rst Outdated
Comment thread Doc/library/inspect.rst Outdated
Comment thread Doc/library/inspect.rst Outdated
graingert and others added 3 commits September 2, 2026 10:32
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Review feedback: use "function-like objects" and link the duck-typing
glossary term rather than saying "duck-type functions".  This matches
the wording already used in the NEWS entry for pythongh-84753.
@johnslavik
johnslavik requested a review from encukou September 2, 2026 09:41

@johnslavik johnslavik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@encukou, what do you think?

@encukou encukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As a tightly scoped PR, this makes sense.

"function-like objects now return True" technically isn't true, but the same wording is in the notes above and below.

"Duck-typed function-like objects" is vague, but if we wanted precision, that should go in the main prose, not in a versionchanged note.

I could do without the comments in inspect.py, but they're not harmful.

I removed the NEWS entry though; we don't add those for docs.

@encukou
encukou merged commit 1059e80 into python:main Sep 3, 2026
55 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Sep 3, 2026
@encukou encukou added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 3, 2026
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

Thanks @graingert for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @graingert for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Sep 3, 2026
@bedevere-app

bedevere-app Bot commented Sep 3, 2026

Copy link
Copy Markdown

GH-156881 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 3, 2026
@bedevere-app

bedevere-app Bot commented Sep 3, 2026

Copy link
Copy Markdown

GH-156882 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 3, 2026
@graingert
graingert deleted the document-duck-type-is-star-function branch September 3, 2026 08:39
encukou pushed a commit that referenced this pull request Sep 3, 2026
…94987) (#156881)

Document when these functions started checking code flags for "duck-typed" function-like objects.
(cherry picked from commit 1059e80)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
encukou pushed a commit that referenced this pull request Sep 3, 2026
…94987) (#156880)

Document when these functions started checking code flags for "duck-typed" function-like objects.
(cherry picked from commit 1059e80)

Co-authored-by: Thomas Grainger <tagrain@gmail.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 stale Stale PR or inactive for long period of time.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants