-
Notifications
You must be signed in to change notification settings - Fork 892
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
fix: fix tab-space mix with tab indenation and continuation_align_style=SPACE #970
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
a7ea234
to
24ed832
Compare
I'm sorry to get to this so late. Could you update the CHANGELOG please? Also, please add a test case derived from the original issue. |
24ed832
to
f9cd73c
Compare
OK, I created a changelog entry. |
I would prefer the testcase just so we have a concrete example of what we're fixing, so that if something goes wrong we won't mess it up. |
(To clarify: Iʼm a member of the general public, not Google) I think what you want is best solved with just using The point of using spaces for alignment is so that something like def foo_function(arg1, arg2,
arg3):
» return [
» 'hello',
» 'world',
» ] looks good (ie. the Maybe a better simple option would be to have the default |
Since Python3 mixing tabs with spaces is a SyntaxError - so when |
Putting spaces before a tab is an error. Putting spaces after a tab is not, and even if it were this only uses spaces for continuation lines, not technically indentation, where it definitely isnʼt an error. I just tested with my example code and with def foo2():
» print("Unconditional")
» if foo_function(1,2,3):
» print("Conditional") which uses tabs and then spaces for indentation, not just the alignment yapf generates, and both work in python 3.9.7. And if it were an error, then this PR wouldnʼt help, because not all indentations are a multiple of |
Fixes #967
Let's see what the tests say about this?