-
Notifications
You must be signed in to change notification settings - Fork 23
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
Y066
cases that can't be rewritten
#491
Comments
Specifically, |
Can't your example be rewritten to if sys.version_info >= (3, 10):
def bar(x, *, bar=True): ...
elif sys.version_info >= (3, 8):
def bar(x, *, bar=True, baz=False): ...
else:
def bar(x): ... ? |
My bad! You're right, the |
It does get a bit dicey in some cases, like: if sys.version_info < (3, 8): # Y066 use "if sys.version_info >= (3, 8)"
def bar(x): ...
elif sys.version_info == (3, 10):
def bar(x, *, bar=True): ...
else:
def bar(x, *, bar=True, baz=False): ... is not equivalent to: if sys.version_info == (3, 10):
def bar(x, *, bar=True): ...
elif sys.version_info >= (3, 8):
def bar(x, *, bar=True, baz=False): ...
else:
def bar(x): ... For Python 3.11, it will execute the wrong block, but it's hard to argue about that one. |
I think we have another rule that warns against |
Consider this case:
I don't think it is possible to rewrite this code with
if sys.version_info >= (3, 8)
. Should Y066 be raised in this case?The text was updated successfully, but these errors were encountered: