Title: Equal objects (e. g. `User`) are not recognized as equal · Issue #587 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Equal objects (e. g. `User`) are not recognized as equal · Issue #587 · python-telegram-bot/python-telegram-bot
X Title: Equal objects (e. g. `User`) are not recognized as equal · Issue #587 · python-telegram-bot/python-telegram-bot
Description: Steps to reproduce Create two equal objects. E. g.: user1 = User(id=1, first_name="Equal", last_name="Identical", username="same", type=None, bot=None) user2 = User(id=1, first_name="Equal", last_name="Identical", username="same", type=N...
Open Graph Description: Steps to reproduce Create two equal objects. E. g.: user1 = User(id=1, first_name="Equal", last_name="Identical", username="same", type=None, bot=None) user2 = User(id=1, first_name="Equal", last_n...
X Description: Steps to reproduce Create two equal objects. E. g.: user1 = User(id=1, first_name="Equal", last_name="Identical", username="same", type=None, bot=None) user2 = User(id...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/587
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Equal objects (e. g. `User`) are not recognized as equal","articleBody":"### Steps to reproduce\r\n1. Create two equal objects. E. g.:\r\n```\r\nuser1 = User(id=1, first_name=\"Equal\", last_name=\"Identical\", username=\"same\", type=None, bot=None)\r\nuser2 = User(id=1, first_name=\"Equal\", last_name=\"Identical\", username=\"same\", type=None, bot=None)\r\n```\r\n\r\n2. Compare the objects: `assert user1 == user2`\r\n\r\n### Expected behaviour\r\nThe assertion should pass: The equality comparison should return `True`.\r\n\r\n### Actual behaviour\r\nThe assertion fails:\r\n```\r\n\u003e assert user1 == user2\r\nE assert \u003ctelegram.use...at 0x041006F0\u003e == \u003ctelegram.user...at 0x041006D0\u003e\r\n```\r\n\r\n### Configuration\r\n**Operating System:**\r\nWindows 10\r\n\r\n\r\n**Version of Python, python-telegram-bot \u0026 dependencies:**\r\nPython 3.6.1\r\npython-telegram-bot commit 45414761439d1df86e11f47ec14026f73c8c48a8\r\n\r\n### Possible fix\r\nImplementing the rich comparison method `__eq__` for the class. Implementing `__hash__` alongside might be a good idea.\r\n\r\n### Notes\r\nThis probably not only holds for the `User` object, but for all Telegram objects.","author":{"url":"https://github.com/j-maas","@type":"Person","name":"j-maas"},"datePublished":"2017-04-29T20:33:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/587/python-telegram-bot/issues/587"}
| 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:cdba276c-1238-b25d-05c2-e9ec9836534d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C228:238CA7:7129A1:907B7C:6A5C0737 |
| html-safe-nonce | 652172f1ff34676bc96b812804ddbcea085463c286f5d6b18294b821f906ff2d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjI4OjIzOENBNzo3MTI5QTE6OTA3QjdDOjZBNUMwNzM3IiwidmlzaXRvcl9pZCI6IjUyMzE5MTk5MTA5NjQ5NTQ5MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5138fcc8d9b716f416e1b00fb43b7736f45bb39bda978a4a091a0b9b5ff06889 |
| hovercard-subject-tag | issue:225283406 |
| 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-telegram-bot/python-telegram-bot/587/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e79dbdfeeb7a3cefa2f4f2814911d8dd87d0250d9d8fdf7fa1ffad75ec3d1453/python-telegram-bot/python-telegram-bot/issues/587 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e79dbdfeeb7a3cefa2f4f2814911d8dd87d0250d9d8fdf7fa1ffad75ec3d1453/python-telegram-bot/python-telegram-bot/issues/587 |
| og:image:alt | Steps to reproduce Create two equal objects. E. g.: user1 = User(id=1, first_name="Equal", last_name="Identical", username="same", type=None, bot=None) user2 = User(id=1, first_name="Equal", last_n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | j-maas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width