Title: Add operator.is_none() · Issue #115808 · python/cpython · GitHub
Open Graph Title: Add operator.is_none() · Issue #115808 · python/cpython
X Title: Add operator.is_none() · Issue #115808 · python/cpython
Description: Feature or enhancement Proposal: With floating point data, the float('NaN') special value is commonly used as a placeholder for missing values. We provide math.isnan to support stripping out those values prior to sorting or summation: >>...
Open Graph Description: Feature or enhancement Proposal: With floating point data, the float('NaN') special value is commonly used as a placeholder for missing values. We provide math.isnan to support stripping out those ...
X Description: Feature or enhancement Proposal: With floating point data, the float('NaN') special value is commonly used as a placeholder for missing values. We provide math.isnan to support stripping ou...
Opengraph URL: https://github.com/python/cpython/issues/115808
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add operator.is_none()","articleBody":"# Feature or enhancement\r\n\r\n### Proposal:\r\n\r\nWith floating point data, the `float('NaN')` special value is commonly used as a placeholder for missing values. We provide `math.isnan` to support stripping out those values prior to sorting or summation:\r\n\r\n```python\r\n\u003e\u003e\u003e from math import isnan\r\n\u003e\u003e\u003e from itertools import filterfalse\r\n\u003e\u003e\u003e data = [3.3, float('nan'), 1.1, 2.2]\r\n\u003e\u003e\u003e sorted(filterfalse(isnan, data))\r\n[1.1, 2.2, 3.3]\r\n```\r\n\r\nFor non-float data, the `None` special value is commonly used as a placeholder for missing values. I propose a new function in the operator module analogous to `math.isnan()`:\r\n\r\n```pycon\r\n\u003e\u003e\u003e data = ['c', None, 'a', 'b']\r\n\u003e\u003e\u003e sorted(filterfalse(is_none, data))\r\n['a', 'b', 'c']\r\n```\r\n\r\nThis helps fulfill a primary use case for the operator module which is to support functional programming with `map()`, `filter()`, etc.\r\n\r\n### Has this already been discussed elsewhere?\r\n\r\nNo response given\r\n\r\n### Links to previous discussion of this feature:\r\n\r\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-115814\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/rhettinger","@type":"Person","name":"rhettinger"},"datePublished":"2024-02-22T08:38:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/115808/cpython/issues/115808"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6b7f5ce1-a1f1-1724-46bb-1c0c399fe4b8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E1A6:28C0E5:6A71BAA:8F95029:6A5E1B52 |
| html-safe-nonce | 0fecb148e6ec2eda8d391a0420690fdfb28b4a3870dc4e75c633b98ecbf2a6b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUE2OjI4QzBFNTo2QTcxQkFBOjhGOTUwMjk6NkE1RTFCNTIiLCJ2aXNpdG9yX2lkIjoiNDk0MzA1MjUwOTU1OTAwMzk4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aa84b0cef1d70d6c3dc13b2153c025f57ff50167a7a206b0ba14878f5d8ea9b5 |
| hovercard-subject-tag | issue:2148518675 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/115808/issue_layout |
| twitter:image | https://opengraph.githubassets.com/984a9691d10a7b8126467f253f7343d845010d3d8480f9da41c71ccd64524c1f/python/cpython/issues/115808 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/984a9691d10a7b8126467f253f7343d845010d3d8480f9da41c71ccd64524c1f/python/cpython/issues/115808 |
| og:image:alt | Feature or enhancement Proposal: With floating point data, the float('NaN') special value is commonly used as a placeholder for missing values. We provide math.isnan to support stripping out those ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rhettinger |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a60e060dad2c24f72179d36247204b454da37845d1728020cd42046a433f87f |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0ae7f3ea7b1bb2f1f4623bb093bbf54cee05d830 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width