-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
help wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Hello, currently UP007 covers both Union[a, b, c] -> a | b | c and Optional[a] -> a | None.
Personally i find Optional to be more readable and PEP 604 does not deprecate this syntax either.
I'm not sure how it could be changed without breaking changes. I see 2 ways:
UP007stops reporting Optional, keeps reporting Union and later added rulesUP039is added which only reports Optional
The downside of this is that it forces people to update config to get previous behavior if they didn't have entire UP category enabled. Alternative is:
UP007remains unchangedUP039is added which reports Union and later added rules
This might be even worse because
- for people with
UPin config it does double work - if someone had
UPenabled andUP007ignored, the Union lint would reappear (although I'd assume most people who do this because of Optional)
pyupgrade author made it clear in multiple issues that they are not going to change this asottile/pyupgrade#390 (comment). don't know how much you are willing to deviate from "upstream" for cases like this but it would be a nice addition
Skylion007, lengau, marcinwrochna, mkobit, hugobarthelemy and 4 more
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcomeruleImplementing or modifying a lint ruleImplementing or modifying a lint rule