Title: Add matches() and comparison_key(); deprecate __eq__/__hash__ · Issue #224 · derek73/python-nameparser · GitHub
Open Graph Title: Add matches() and comparison_key(); deprecate __eq__/__hash__ · Issue #224 · derek73/python-nameparser
X Title: Add matches() and comparison_key(); deprecate __eq__/__hash__ · Issue #224 · derek73/python-nameparser
Description: Bridge work for #223 (removal of __eq__/__hash__ in 2.0). Shipping the replacements in 1.3.0 means there is one release where old and new APIs coexist: downstream code can adopt matches() while == still works, and libraries supporting bo...
Open Graph Description: Bridge work for #223 (removal of __eq__/__hash__ in 2.0). Shipping the replacements in 1.3.0 means there is one release where old and new APIs coexist: downstream code can adopt matches() while == ...
X Description: Bridge work for #223 (removal of __eq__/__hash__ in 2.0). Shipping the replacements in 1.3.0 means there is one release where old and new APIs coexist: downstream code can adopt matches() while == ...
Opengraph URL: https://github.com/derek73/python-nameparser/issues/224
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add matches() and comparison_key(); deprecate __eq__/__hash__","articleBody":"Bridge work for #223 (removal of `__eq__`/`__hash__` in 2.0). Shipping the replacements in 1.3.0 means there is one release where old and new APIs coexist: downstream code can adopt `matches()` while `==` still works, and libraries supporting both 1.3+ and 2.x need no version sniffing.\n\n## New API (deliberately minimal — the signature is a commitment that survives 2.0)\n\n- `matches(other: str | HumanName) -\u003e bool` — exact, case-insensitive comparison of parsed components. String operands are parsed with `self.C`, so `hn.matches(\"Smith, John\")` and `hn.matches(\"John Smith\")` both match — unlike `==`, which only matches strings that render exactly like `str(hn)`. Raises `TypeError` for other types. Docstring notes: parses on every call — pre-parse or use `comparison_key()` when matching against many rows.\n- `comparison_key() -\u003e tuple[str, ...]` — the seven members (title/first/middle/last/suffix/nickname/maiden), each `\" \".join(...__list).lower()`. Built from the `*_list` attributes, so it is independent of `string_format` and `empty_attribute_default`. Includes `maiden` from day one (new in this release).\n\nNo leniency options (initials matching, nickname equivalence) — that's record linkage territory and out of scope; `matches()` is exact-components by design.\n\n## Deprecation\n\n- `DeprecationWarning` in `__eq__` and `__hash__` naming the replacement\n- Docstring note on where `==` and `matches()` disagree during the overlap: maiden-bearing names vs their own `str()` output, and lossy custom `string_format`s (`matches()` compares all components; that's the fix, not a bug)\n\n## Checklist\n\n- [ ] `matches()` + `comparison_key()` + tests (incl. `TypeError`, comma-form equivalence, case-folding, maiden participation)\n- [ ] Deprecation warnings + tests that they fire\n- [ ] Docs + release log entries referencing #223\n","author":{"url":"https://github.com/derek73","@type":"Person","name":"derek73"},"datePublished":"2026-07-05T20:56:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/224/python-nameparser/issues/224"}
| 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:3b79d283-f71b-3c7f-7caf-b2582844d278 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BEF8:335AF3:3B67FA4:545AAB0:6A56B648 |
| html-safe-nonce | 1639dc511281efc6a0561482ea95c7f3de1fc4a0729e9a5679ce4137fc06a6b1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUY4OjMzNUFGMzozQjY3RkE0OjU0NUFBQjA6NkE1NkI2NDgiLCJ2aXNpdG9yX2lkIjoiNTEzMzQ2MTExNDMwMzQ2MDkzNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f6cef2637457c33d56abbec069a3b6621f0e87ad41530c7d53aac019801493f5 |
| hovercard-subject-tag | issue:4814411733 |
| 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/derek73/python-nameparser/224/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a89db599c1c52f9ec3fa1485c65747eba2affd3bfe94842083e19c2f355ddf56/derek73/python-nameparser/issues/224 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a89db599c1c52f9ec3fa1485c65747eba2affd3bfe94842083e19c2f355ddf56/derek73/python-nameparser/issues/224 |
| og:image:alt | Bridge work for #223 (removal of __eq__/__hash__ in 2.0). Shipping the replacements in 1.3.0 means there is one release where old and new APIs coexist: downstream code can adopt matches() while == ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | derek73 |
| hostname | github.com |
| expected-hostname | github.com |
| None | df99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae |
| turbo-cache-control | no-preview |
| go-import | github.com/derek73/python-nameparser git https://github.com/derek73/python-nameparser.git |
| octolytics-dimension-user_id | 18306 |
| octolytics-dimension-user_login | derek73 |
| octolytics-dimension-repository_id | 18353524 |
| octolytics-dimension-repository_nwo | derek73/python-nameparser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 18353524 |
| octolytics-dimension-repository_network_root_nwo | derek73/python-nameparser |
| 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 | c29ba03b1896083dbe1084f6cd1c5367d8a0d67c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width