Skip to content
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

SPLIT_ALL[_TOP_LEVEL]_COMMA_SEPARATED_VALUES breaks on tuple unpacking #1159

Closed
alexey-pelykh opened this issue Sep 29, 2023 · 1 comment · Fixed by #1173
Closed

SPLIT_ALL[_TOP_LEVEL]_COMMA_SEPARATED_VALUES breaks on tuple unpacking #1159

alexey-pelykh opened this issue Sep 29, 2023 · 1 comment · Fixed by #1173

Comments

@alexey-pelykh
Copy link
Contributor

values = [
  ('a', '1'),
  ('b', '2'),
]
values = [
  really_quite_long_function(some_quite_long_arg, value)
  for some_quite_long_arg, value in values
]

with SPLIT_ALL_COMMA_SEPARATED_VALUES enabled being reformatted to

values = [
    ('a',
     '1'),
    ('b',
     '2'),
]
values = [
    really_quite_long_function(some_quite_long_arg,
                               value) for some_quite_long_arg,
    value in values
]

and with SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES enabled being reformatted to

values = [
    ('a', '1'),
    ('b', '2'),
]
values = [
    really_quite_long_function(some_quite_long_arg, value)
    for some_quite_long_arg,
    value in values
]

while replacing

  for some_quite_long_arg, value in values

with

  for (some_quite_long_arg, value) in values

yields to a different result.

Is this an intended behavior?

@alexey-pelykh alexey-pelykh changed the title SPLIT_ALL[_TOP_LEVEL]_COMMA_SEPARATED_VALUES breaks on generator SPLIT_ALL[_TOP_LEVEL]_COMMA_SEPARATED_VALUES breaks on tuple unpacking Sep 29, 2023
@bwendling
Copy link
Member

I don't think this is intended behavior. The for part shouldn't split like that, even with these flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants