Title: Support comparison operators by christabella · Pull Request #1347 · pythonnet/pythonnet · GitHub
Open Graph Title: Support comparison operators by christabella · Pull Request #1347 · pythonnet/pythonnet
X Title: Support comparison operators by christabella · Pull Request #1347 · pythonnet/pythonnet
Description: What does this implement/fix? Explain your changes. Continuation of https://github.com/pythonnet/pythonnet/pull/1324/files but specifically for comparison operators e.g. >, >=, <, == etc. based on a discussion with @tminka --- in a nutshell, we want to check each C# class for any comparison operator methods when calling ClassBase.tp_richcompare, before proceeding with the usual logic (see #294) which handles C# classes that implement an IComparable interface. Would appreciate a review from @lostmsu who helped with the previous PR that this builds on. Thanks! Does this close any currently open issues? Closes #1312 More concrete examples can also be found in other Infer.NET tutorials e.g. having to use op_GreaterThan https://github.com/dotnet/infer/blob/67b4f80d97018460bcb817f76ec874d0f33f1651/test/TestPython/test_tutorials.py#L31 Any other comments? Some remaining tasks could be: Add tests for derived objects, and for other edge cases (e.g. if truly no operator methods defined, asserting good error messages) When C# class defines operator ==(), the class should also define .Equals and .GetHashCode() https://stackoverflow.com/questions/10790370/whats-wrong-with-defining-operator-but-not-defining-equals-or-gethashcode Checklist Check all those that are applicable and complete. Make sure to include one or more tests for your change If an enhancement PR, please create docs and at best an example Add yourself to AUTHORS Updated the CHANGELOG The tests pass in net472 but not on netcoreapp3.1
Open Graph Description: What does this implement/fix? Explain your changes. Continuation of https://github.com/pythonnet/pythonnet/pull/1324/files but specifically for comparison operators e.g. >, >=, <, == etc. ...
X Description: What does this implement/fix? Explain your changes. Continuation of https://github.com/pythonnet/pythonnet/pull/1324/files but specifically for comparison operators e.g. >, >=, &l...
Opengraph URL: https://github.com/pythonnet/pythonnet/pull/1347
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:042a96f9-6a32-e702-28b9-e75d8b137748 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | AAFE:3DC7AA:34760F3:46CF293:69706DA4 |
| html-safe-nonce | f398e8730c4a794afaf4f9f27cc1a05951a046adb4e34bdd522d39c06df9494d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUZFOjNEQzdBQTozNDc2MEYzOjQ2Q0YyOTM6Njk3MDZEQTQiLCJ2aXNpdG9yX2lkIjoiMzE0MzExMzEzOTc3OTgyNTA2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b92f5332349b5f98b689e5181537c72d06e1ac076f3ef8b864b203ea369d109f |
| hovercard-subject-tag | pull_request:550510701 |
| 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/pythonnet/pythonnet/pull/1347/checks |
| twitter:image | https://avatars.githubusercontent.com/u/2038751?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/2038751?s=400&v=4 |
| og:image:alt | What does this implement/fix? Explain your changes. Continuation of https://github.com/pythonnet/pythonnet/pull/1324/files but specifically for comparison operators e.g. >, >=, <, == etc. ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| 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 | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width