Title: max() works with greater-than or less-than · Issue #6575 · python/typeshed · GitHub
Open Graph Title: max() works with greater-than or less-than · Issue #6575 · python/typeshed
X Title: max() works with greater-than or less-than · Issue #6575 · python/typeshed
Description: Currently max() expects __gt__, but this example indicates that it also works if only __lt__ is present: class Lt: def __init__(self, x): self.x = x def __repr__(self): return f"Lt({self.x})" def __lt__(self, other): return self.x < othe...
Open Graph Description: Currently max() expects __gt__, but this example indicates that it also works if only __lt__ is present: class Lt: def __init__(self, x): self.x = x def __repr__(self): return f"Lt({self.x})" def _...
X Description: Currently max() expects __gt__, but this example indicates that it also works if only __lt__ is present: class Lt: def __init__(self, x): self.x = x def __repr__(self): return f"Lt({self.x})&q...
Opengraph URL: https://github.com/python/typeshed/issues/6575
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"max() works with greater-than or less-than","articleBody":"Currently `max()` expects `__gt__`, but this example indicates that it also works if only `__lt__` is present:\r\n```py\r\nclass Lt:\r\n def __init__(self, x):\r\n self.x = x\r\n\r\n def __repr__(self):\r\n return f\"Lt({self.x})\"\r\n\r\n def __lt__(self, other):\r\n return self.x \u003c other.x\r\n\r\nclass Gt:\r\n def __init__(self, x):\r\n self.x = x\r\n\r\n def __repr__(self):\r\n return f\"Gt({self.x})\"\r\n\r\n def __gt__(self, other):\r\n return self.x > other.x\r\n\r\nprint(max(Lt(2), Lt(5))) # Lt(5)\r\nprint(max(Lt(5), Lt(2))) # Lt(5)\r\nprint(max(Gt(2), Gt(5))) # Gt(5)\r\nprint(max(Gt(5), Gt(2))) # Gt(5)\r\n```\r\n\r\nI think that we should accept either method.\r\n\r\nThe signature of `max()` was changed to expect `__gt__` in #6342.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2021-12-13T13:19:37Z","url":"https://github.com/python/typeshed/issues/6575"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:8b3fa21a-651a-8d0f-8ced-0f715ac8a3ef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A424:18F8F:420E9D:58EF9B:6B00A3CE |
| html-safe-nonce | 2a1fe71ab51e6692965b52cf8b1065e274c1d0b0c20476080a361e9b8e21f534 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDI0OjE4RjhGOjQyMEU5RDo1OEVGOUI6NkIwMEEzQ0UiLCJ2aXNpdG9yX2lkIjoiMzc3NjQxMDQ2MTM1Mjc5NzEzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c0790a8d3d199cd6134bc7e4b4d626c12072c4d90493359fc841a364023b3ec6 |
| hovercard-subject-tag | issue:1078523609 |
| 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/typeshed/6575/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1be2694495671b0e031a4b4ad00d2bd35a450190d5536bc70e70ff228e81a6bc/python/typeshed/issues/6575 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1be2694495671b0e031a4b4ad00d2bd35a450190d5536bc70e70ff228e81a6bc/python/typeshed/issues/6575 |
| og:image:alt | Currently max() expects __gt__, but this example indicates that it also works if only __lt__ is present: class Lt: def __init__(self, x): self.x = x def __repr__(self): return f"Lt({self.x})" def _... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | 455b493e3402a3a3a06beac5d20bb7db3da060808b220aa48d6a7eca7c59863a |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | 2f575159976167242d488c0b062eb355c4e198b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width