Title: Forbid usage of `functools.singledispatch` · Issue #1360 · usethis-python/usethis-python · GitHub
Open Graph Title: Forbid usage of `functools.singledispatch` · Issue #1360 · usethis-python/usethis-python
X Title: Forbid usage of `functools.singledispatch` · Issue #1360 · usethis-python/usethis-python
Description: Toward #1340. singledispatch has semantics which don't play nicely with static analysis. Arguably, they're needlessly verbose. I would prefer to refactor just use if-branch logic. We should set up a Ruff rule for this, e.g. using example...
Open Graph Description: Toward #1340. singledispatch has semantics which don't play nicely with static analysis. Arguably, they're needlessly verbose. I would prefer to refactor just use if-branch logic. We should set up ...
X Description: Toward #1340. singledispatch has semantics which don't play nicely with static analysis. Arguably, they're needlessly verbose. I would prefer to refactor just use if-branch logic. We should...
Opengraph URL: https://github.com/usethis-python/usethis-python/issues/1360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Forbid usage of `functools.singledispatch`","articleBody":"Toward #1340.\n\n`singledispatch` has semantics which don't play nicely with static analysis. Arguably, they're needlessly verbose.\n\nI would prefer to refactor just use if-branch logic.\n\nWe should set up a Ruff rule for this, e.g. using example config from docs:\n\n[banned-api](https://docs.astral.sh/ruff/settings/#lint_flake8-tidy-imports_banned-api)\n\nSpecific modules or module members that may not be imported or accessed. Note that this rule is only meant to flag accidental uses, and can be circumvented via eval or importlib.\n\nDefault value: {}\n\nType: dict[str, { \"msg\": str }]\n\nExample usage:\n\n\n[pyproject.toml](https://docs.astral.sh/ruff/settings/#__tabbed_108_1)\n[ruff.toml](https://docs.astral.sh/ruff/settings/#__tabbed_108_2)\n\n[lint.flake8-tidy-imports.banned-api]\n\"cgi\".msg = \"The cgi module is deprecated, see https://peps.python.org/pep-0594/#cgi.\"\n\"typing.TypedDict\".msg = \"Use typing_extensions.TypedDict instead.\"","author":{"url":"https://github.com/nathanjmcdougall","@type":"Person","name":"nathanjmcdougall"},"datePublished":"2026-03-11T01:05:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1360/usethis-python/issues/1360"}
| 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:b6818f31-f46d-cf4f-bf14-cf4f6897b19d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9882:3D6334:2E1FE4:40BA3E:6A4C9F23 |
| html-safe-nonce | 5c4350073b1d928c98feda5b6e06d59a8420ec8f6c02f8b510659efc6ac39b47 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODgyOjNENjMzNDoyRTFGRTQ6NDBCQTNFOjZBNEM5RjIzIiwidmlzaXRvcl9pZCI6IjMwMzM5NjYzNTU2NzE3MTk3MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 095010618e15dbb6a4302ef6efa54c190800f2b9f9fb3f31f8198d5719c85340 |
| hovercard-subject-tag | issue:4055055754 |
| 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/usethis-python/usethis-python/1360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/85b61650652f4acea9718dd02466a73e7731af00e18dc784eeb571a16419fe9e/usethis-python/usethis-python/issues/1360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/85b61650652f4acea9718dd02466a73e7731af00e18dc784eeb571a16419fe9e/usethis-python/usethis-python/issues/1360 |
| og:image:alt | Toward #1340. singledispatch has semantics which don't play nicely with static analysis. Arguably, they're needlessly verbose. I would prefer to refactor just use if-branch logic. We should set up ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nathanjmcdougall |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| 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 | ae90d426644ca15e89bacceb72e51f4e9dbf85f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width