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

Line too long: Attribute chain on left hand side of assignment #2434

Open
glyph opened this issue Aug 20, 2021 · 0 comments
Open

Line too long: Attribute chain on left hand side of assignment #2434

glyph opened this issue Aug 20, 2021 · 0 comments
Labels
F: linebreak How should we split up lines? F: linetoolong Black makes our lines too long T: style What do we want Blackened code to look like?

Comments

@glyph
Copy link

glyph commented Aug 20, 2021

Describe the style change

Sometimes you need to access attributes deep within another object or with extremely long names, and Black helpfully tries to wrap the right hand side of the expression to avoid blowing the length limit, but doesn't touch the right.

Examples in the current Black style

(
    something.something_else.hideously_long_attribute_name.other_property.even_deeper.finally_getting_close.okay
) = 1

Desired style

(
    something
    .something_else
    .hideously_long_attribute_name
    .other_property
    .even_deeper
    .finally_getting_close
    .okay
) = 1

Additional context

My example may evoke appeals to the Law of Demeter, but equally frequent is the issue of very long and descriptive attribute names, not just paths this reductio-ad-absurdum long.

@glyph glyph added the T: style What do we want Blackened code to look like? label Aug 20, 2021
@ichard26 ichard26 added F: linebreak How should we split up lines? F: linetoolong Black makes our lines too long labels Aug 20, 2021
@JelleZijlstra JelleZijlstra changed the title extremely long left hand side expressions are not reflowed at all Line too long: Attribute chain on left hand side of assignment Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? F: linetoolong Black makes our lines too long T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants