GeezerVison is showing github.com — gh-149083: Make functools.Placeholder a sentinel by JelleZijlstra · Pull Request #149088 · python/cpython
Conversation
JelleZijlstra
commented
Apr 28, 2026
•
edited by github-actions
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
picnixz
commented
Apr 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Is type(Placeholder)() acceptable? I would have actually expected that type(MySentinel)() returned the sentinel as for type(None)() but it's not the case since MySentinel is an instance of a sentinel!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Actually, since we're launching beta, it may be ok to change this and see if it breaks something
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It's difficult to imagine why people would be doing things like type(Placeholder)() outside of test code, but you never know.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I can see people doing type(Placeholder) for maybe their mypy plugin or whatever, or even for checking if a default is a placeholder instance and do something else with it (though they should assume that it's a singleton so there is no real need to check placeholders through isinstance checks). I think there was a discussion when introducing placeholders about type(P)() returning P but I can't find it (and maybe I remembered wrongly). One could argue that type(Placeholder) could also be used for type annotations =/
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 90 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
rhettinger
commented
Oct 31, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I'm not worried about the type(Placeholder) issue. That is an undocumented, unimportant, and unintended implementation detail.
|
picnixz reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
picnixz
picnixz left review comments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|