-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Question: Does the code format differ between versions of python 3 (3.7, 3.8, 3.9) ? #2383
Comments
Off the top of my head, you will get some differences when it comes to version-specific features, but only in very limited cases. For a minimal reproducible example, have a look at the following script: if x := False:
print("what?") Walrus was introduced 3.8 I believe, which means a 37 vs 38 black will have slightly different behavior (only in certain cases).
But not the following:
In short: yes, there is some difference in behavior (mostly in AST parsing in this case), but you may not notice it depending on your code. If your codebase is not intended to support 3.7, then it's probably safe to ignore this. If 3.7 is supported though, it may make sense to keep it. |
Thank you @HassanAbouelela ! This is a very helpful answer. |
I think the tl;dr here is just run black under the newest cpython runtime possible (or in use at your company) and you should have less issues as newer version ast will have more support.
|
Hello,
Not sure where the best place to ask this question is so I decided to file an issue. In my organization, we've been running black for a couple of months under python versions 3.7 and 3.8 in our CI and I've never noticed that the output is different between the two.
Is there any scenario where the code style between the python 3 versions will be different? I'm wondering if I should suggest that we only run black with python 3.8.
Thank you! I love using your package.
The text was updated successfully, but these errors were encountered: