Title: fix: enhance missing methods to handle missing keys more explicitly i… by t4m4k0ty4 · Pull Request #59 · fluentpython/example-code-2e · GitHub
Open Graph Title: fix: enhance missing methods to handle missing keys more explicitly i… by t4m4k0ty4 · Pull Request #59 · fluentpython/example-code-2e
X Title: fix: enhance missing methods to handle missing keys more explicitly i… by t4m4k0ty4 · Pull Request #59 · fluentpython/example-code-2e
Description: Description This PR improves the implementation of missing methods across several mapping subclasses to ensure safer and more predictable behavior when attempting to access keys in a case-insensitive manner. Problem In the original version, calls to self[_upper(key)] were made without checking if the transformed key actually exists. This could result in unhandled KeyErrors or unintended recursion, especially in dictionary-like structures where missing is automatically called upon a missing key. Impact of my solution This change enhances code clarity and error safety, making the behavior of custom mappings more robust and closer to Python’s expectations for missing.
Open Graph Description: Description This PR improves the implementation of missing methods across several mapping subclasses to ensure safer and more predictable behavior when attempting to access keys in a case-insensiti...
X Description: Description This PR improves the implementation of missing methods across several mapping subclasses to ensure safer and more predictable behavior when attempting to access keys in a case-insensiti...
Opengraph URL: https://github.com/fluentpython/example-code-2e/pull/59
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:7e67cbaa-149b-351e-0d7f-8d1a62747a9b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 85A0:74018:1391FE0:19CF479:697189D4 |
| html-safe-nonce | 36fa402d8a9503946ec444f5389f0d7221dfceda6906c51b55999828c25a911c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUEwOjc0MDE4OjEzOTFGRTA6MTlDRjQ3OTo2OTcxODlENCIsInZpc2l0b3JfaWQiOiI0Nzk1ODY5NDA5MTQ4MjQyMzg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1ddf8c5fd65c4a3f937df4c7d907228a7b3cc17390c9d1acb846781429e11531 |
| hovercard-subject-tag | pull_request:2661024864 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/fluentpython/example-code-2e/pull/59/files |
| twitter:image | https://avatars.githubusercontent.com/u/194794071?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/194794071?s=400&v=4 |
| og:image:alt | Description This PR improves the implementation of missing methods across several mapping subclasses to ensure safer and more predictable behavior when attempting to access keys in a case-insensiti... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b0f2f00499ad3dd2c21ad030a3c403edca54df20ea256f6517c6d8c4fa3a1a4 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/fluentpython/example-code-2e git https://github.com/fluentpython/example-code-2e.git |
| octolytics-dimension-user_id | 9216311 |
| octolytics-dimension-user_login | fluentpython |
| octolytics-dimension-repository_id | 176997413 |
| octolytics-dimension-repository_nwo | fluentpython/example-code-2e |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 176997413 |
| octolytics-dimension-repository_network_root_nwo | fluentpython/example-code-2e |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 67235153f3c1514ed5f7dc469f138abc377bd388 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width