-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linkcheck: update implementation to make use of py311 features #13036
linkcheck: update implementation to make use of py311 features #13036
Conversation
…tern matching (PEP 636)
…tural pattern matching (PEP 636)
…ssage 'old' currently)
…xisting dictionary-lookup instead of structural-pattern-match
Fairly pointless `match` statement
Relates-to commit 7df2e98.
Could you elaborate on the case for using StrEnum over plain strings? Can we use match/case with literal values? I'd prefer to split the changes to use match-case and to use an enum, as they can be done separately, and it reduces the diff. A |
The main benefit I'm seeking with that change is to reduce the chance that a typo/change to a status code in one part of the code isn't caught by typechecking / code review -- currently they are string literals, so the reader has to be aware that they are used for equality checks and must be kept consistent/equal.
Yep, that would be possible. I would personally prefer to apply the enum refactoring first, because it introduces the kind of symbol-strictness that could catch problems in a refactor that involves string literals.
Makes sense; I think I've been a bit hasty putting this pull request together. I'll begin afresh with a simpler, enum-only refactor soon (within the next week or so) if that sounds reasonable. I'd like to get that in place before an implementation of #12985. Edit: s/seeing/seeking -- typo with change-of-interpretation (!) |
That seems reasonable. In the interim we could tighten up the static typing from A |
Feature or Bugfix
Purpose
StrEnum
values to provide type-checkable linkcheck status codes.Detail
StrEnum
and Structural Pattern Matching support (ref Drop support for Python 3.10 #13000).local
,old
).Relates