-
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
Remove underscores in numeric literals #2957
Comments
We previously did this (inserting underscores every third digit only), but undid it because it was causing issues when we inserted underscores into numeric ids, making them harder to grep. I suppose we could remove extra underscores in cases like your first example, but I'm not sure that's really worth the complexity. |
I agree it would be a hassle to try and handle the every third digit logic. My suggestion was actually just remove all underscores since that's consistent/simple. Although, if it turns out using these underscores is a common occurrence then I'd be happy to leave this as out of scope for black 👍 |
Well, I'd feel bad about making Black totally remove all usage of a language feature :) The place where the underscores shine is if you have |
haha that's a fair point, in that case I understand why we leave it the users to handle these! Thanks 😄 |
Is your feature request related to a problem? Please describe.
I've just learned that this
is a valid alternative way of writing
I think the intention is to let people break up large numbers if they want i.e.
1_000_000
instead of1000000
Describe the solution you'd like
Should we decide on a consistent format for
black
and remove these underscores?Describe alternatives you've considered
I've double checked and the AST is the same regardless of the presence of the underscores so we should be able to fix them without changing the AST
The text was updated successfully, but these errors were encountered: