Title: gh-104050: Improve some typing around `default`s and sentinel values by AlexWaygood · Pull Request #104626 · python/cpython · GitHub
Open Graph Title: gh-104050: Improve some typing around `default`s and sentinel values by AlexWaygood · Pull Request #104626 · python/cpython
X Title: gh-104050: Improve some typing around `default`s and sentinel values by AlexWaygood · Pull Request #104626 · python/cpython
Description: Convert unspecified and unknown to be members of a Sentinels enum, rather than instances of bespoke classes. An enum feels more idiomatic here, and works better with type checkers. Convert some == and != checks for these values to identity checks, which are more idiomatic with sentinels. Don't do the same for Null, as this needs to be a distinct type due to its usage in clinic.py. Use object as the annotation for default across clinic.py. default can be literally any object, so object is the correct annotation here. Issue: gh-104050
Open Graph Description: Convert unspecified and unknown to be members of a Sentinels enum, rather than instances of bespoke classes. An enum feels more idiomatic here, and works better with type checkers. Convert some ==...
X Description: Convert unspecified and unknown to be members of a Sentinels enum, rather than instances of bespoke classes. An enum feels more idiomatic here, and works better with type checkers. Convert some ==...
Opengraph URL: https://github.com/python/cpython/pull/104626
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:500b82e2-513f-4ed6-effe-855b195bfb58 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | D7EE:1D5ACA:437BD4:58CAF7:69697FD5 |
| html-safe-nonce | b0dbfe09d33f2f0c55d5b495d84bd25550e4880f8741fad849f3909031a1cfdd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0VFOjFENUFDQTo0MzdCRDQ6NThDQUY3OjY5Njk3RkQ1IiwidmlzaXRvcl9pZCI6IjYyOTIwMTkyNjUyNTQ1NTU2MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 37f3a2a617b2507c64b0b44bae60b1ab4a75873ff1dc9be17e67f9c5fcc52171 |
| hovercard-subject-tag | pull_request:1356304857 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/104626/checks |
| twitter:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/66076021?s=400&v=4 |
| og:image:alt | Convert unspecified and unknown to be members of a Sentinels enum, rather than instances of bespoke classes. An enum feels more idiomatic here, and works better with type checkers. Convert some ==... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width