René's URL Explorer Experiment


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. &gt;, &gt;=, &l...

Opengraph URL: https://github.com/pythonnet/pythonnet/pull/1347

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c6b9aa06-afbd-301b-1a60-b49d098ca46a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE782:32E262:2701851:347EB60:69706D37
html-safe-nonce0549ffa102a008fedcfc72a53c81ac08fe99d9a69746aa660c9fb0e72aa06c08
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzgyOjMyRTI2MjoyNzAxODUxOjM0N0VCNjA6Njk3MDZEMzciLCJ2aXNpdG9yX2lkIjoiNDM1MDc1MjE3NTU1MDM5MzY1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc516fdf69a7a4e216795736f9147f98a8ecb6729d30c0e4789551d38cbc81396
hovercard-subject-tagpull_request:550510701
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/pull/1347/files
twitter:imagehttps://avatars.githubusercontent.com/u/2038751?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/2038751?s=400&v=4
og:image:altWhat 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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git
octolytics-dimension-user_id6050430
octolytics-dimension-user_loginpythonnet
octolytics-dimension-repository_id14748123
octolytics-dimension-repository_nwopythonnet/pythonnet
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14748123
octolytics-dimension-repository_network_root_nwopythonnet/pythonnet
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7d6181066430cc06553c8396ca201e194ae33cb9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pythonnet/pythonnet/pull/1347/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fpull%2F1347%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fpull%2F1347%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=pythonnet%2Fpythonnet
Reloadhttps://github.com/pythonnet/pythonnet/pull/1347/files
Reloadhttps://github.com/pythonnet/pythonnet/pull/1347/files
Reloadhttps://github.com/pythonnet/pythonnet/pull/1347/files
pythonnet https://github.com/pythonnet
pythonnethttps://github.com/pythonnet/pythonnet
Notifications https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Fork 770 https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Star 5.4k https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Code https://github.com/pythonnet/pythonnet
Issues 155 https://github.com/pythonnet/pythonnet/issues
Pull requests 18 https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects 0 https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/pythonnet/pythonnet/security
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/1347/files
Insights https://github.com/pythonnet/pythonnet/pulse
Code https://github.com/pythonnet/pythonnet
Issues https://github.com/pythonnet/pythonnet/issues
Pull requests https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security https://github.com/pythonnet/pythonnet/security
Insights https://github.com/pythonnet/pythonnet/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpythonnet%2Fpythonnet%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpythonnet%2Fpythonnet%2Fissues%2Fnew%2Fchoose
lostmsuhttps://github.com/lostmsu
pythonnet:masterhttps://github.com/pythonnet/pythonnet/tree/master
christabella:feat/comparison-operatorshttps://github.com/christabella/pythonnet/tree/feat/comparison-operators
Conversation 19 https://github.com/pythonnet/pythonnet/pull/1347
Commits 12 https://github.com/pythonnet/pythonnet/pull/1347/commits
Checks 0 https://github.com/pythonnet/pythonnet/pull/1347/checks
Files changed https://github.com/pythonnet/pythonnet/pull/1347/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/1347/files
Support comparison operators https://github.com/pythonnet/pythonnet/pull/1347/files#top
Show all changes 12 commits https://github.com/pythonnet/pythonnet/pull/1347/files
9a8cb96 Add comparison operators christabella Dec 29, 2020 https://github.com/pythonnet/pythonnet/pull/1347/commits/9a8cb966faf8a7cdaa10dbf5db05d465b2760189
bcbace3 Add tests for logical (bool) comparison operators christabella Dec 29, 2020 https://github.com/pythonnet/pythonnet/pull/1347/commits/bcbace35ba5ad003c8eb6336be81e4302397efdf
31f3ed1 Finish comparison operator impl and add tests christabella Jan 6, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/31f3ed1309ddb7358f0a7ec315bdd006d048aaad
ae7e774 Add eq and ineq operators, disallow reverse for comp christabella Jan 7, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/ae7e774c4564de86b69c9f46ac6767db199eae80
5685727 Minor formatting (whitespace, ordering) christabella Jan 7, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/56857271287d3aa465160ba1bcfc9389dafeea19
03a73c0 Minor: use `out var` instead of declaring separately. christabella Jan 7, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/03a73c08f5f1e70cd9ef1ce5d8ae7a2e47e92df7
67928e1 Implement .Equals and .GetHashCode to fix warning christabella Jan 7, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/67928e1078b6290c781a4ed789177f4a7dc6e9cd
6a64678 Style (TryGetValue), formatting, and minor changes christabella Jan 8, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/6a64678207ba251568d6f566975fa400872d29a9
9dd9162 Use a separate map for comparison operators christabella Jan 8, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/9dd9162d89bddb8106563fa775a0c3439e95a876
a8c6591 Add tuple comparison operator tests (2/6) christabella Jan 11, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/a8c659158d1daff05063bbdff7710217ff4b697b
6d4dec7 Add reverse case for tuple comparison op test christabella Jan 11, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/6d4dec7ef5955f2edba5fac68f50cd9e010cef11
7a2b5e2 Simplify PyObj casting, logic of if blocks. christabella Jan 12, 2021 https://github.com/pythonnet/pythonnet/pull/1347/commits/7a2b5e296475d72854f7b52ea1ba6652131c5836
Clear filters https://github.com/pythonnet/pythonnet/pull/1347/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/1347/files
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/1347/files
TestOperator.cs https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
classbase.cs https://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
classmanager.cs https://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
methodbinder.cs https://github.com/pythonnet/pythonnet/pull/1347/files#diff-237dc718ad5424f5476d2ebbbc4e5164c95901bd2a4c2daaf8ca6fc9f9d3a5fb
operatormethod.cs https://github.com/pythonnet/pythonnet/pull/1347/files#diff-04b7ac9ad91b00c6d8a37f3eedab8474bb7c0bed8abb3826440125df67a412ac
src/embed_tests/TestOperator.cshttps://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
View file https://github.com/christabella/pythonnet/blob/7a2b5e296475d72854f7b52ea1ba6652131c5836/src/embed_tests/TestOperator.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/1347/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/1347/files
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-f103fc6df52b19f5e7acc4d2fce4f86a9c1f70aff0c1edec000871254ed9cb70
src/runtime/classbase.cshttps://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
View file https://github.com/christabella/pythonnet/blob/7a2b5e296475d72854f7b52ea1ba6652131c5836/src/runtime/classbase.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/1347/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-32bee523619b42a59c7c60132a7d605f738b74bf85b7288552d57b6dd03c96d0
src/runtime/classmanager.cshttps://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
View file https://github.com/christabella/pythonnet/blob/7a2b5e296475d72854f7b52ea1ba6652131c5836/src/runtime/classmanager.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/1347/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-0b7bf56d2368f421761db6d9ca5c28d3fd45ad1bea2d90aa68dd6c241fe4c7c3
src/runtime/methodbinder.cshttps://github.com/pythonnet/pythonnet/pull/1347/files#diff-237dc718ad5424f5476d2ebbbc4e5164c95901bd2a4c2daaf8ca6fc9f9d3a5fb
View file https://github.com/christabella/pythonnet/blob/7a2b5e296475d72854f7b52ea1ba6652131c5836/src/runtime/methodbinder.cs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/pythonnet/pythonnet/pull/1347/{{ revealButtonHref }}
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-237dc718ad5424f5476d2ebbbc4e5164c95901bd2a4c2daaf8ca6fc9f9d3a5fb
https://github.com/pythonnet/pythonnet/pull/1347/files#diff-237dc718ad5424f5476d2ebbbc4e5164c95901bd2a4c2daaf8ca6fc9f9d3a5fb
Please reload this pagehttps://github.com/pythonnet/pythonnet/pull/1347/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.