Skip to content

Conversation

@loechel
Copy link
Member

@loechel loechel commented Sep 18, 2017

Cleanup for readability.

#73 element as separate pull request.

Copy link
Member

@icemac icemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it locally:

  • flake8-isort does not require any changes, so I am fine with it.
  • flake8-strict generates many false positives, makes the code worse readable (It tricked me to believe that [].append(3,) would append the tuple (3, ).), so I vote against using this plug-in.

flags=0,
dont_inherit=False,
policy=RestrictingNodeTransformer,
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this one is less readable.

type=v.__class__.__name__,
msg=v.msg,
statement=v.text.strip(),
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comma seems to be wrong. On the first look it seemed to me that a tuple from the string generated using .format() is appended.
I was wrong, but this hurts instead of it does help.

flags=0,
dont_inherit=False,
policy=RestrictingNodeTransformer,
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

converter = self.protect_unpack_sequence(
target,
ast.Name(tmp_name, ast.Load()))
ast.Name(tmp_name, ast.Load()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A trailing comma in lists, tuples or dicts is okay but having it in each function call is nonsense.

reason="Print statement is gone in Python 3."
"Test Deprecation Warming in Python 2")
"Test Deprecation Warning in Python 2"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is more readable. Because of the nearly empty line above the function definition the decorator does not seem to belong to the function.

@icemac
Copy link
Member

icemac commented Sep 20, 2017

https://www.python.org/dev/peps/pep-0008/#when-to-use-trailing-commas could be read the way flake-strict does it but I do not think that this is the intension of this part of PEP-8. Trailing commas are for version control systems to make the diff smaller if something is added. But this was written before git which is able to render nice diffs even when adding a comma to the previous line before adding a new line to a list.

@icemac
Copy link
Member

icemac commented Nov 30, 2017

@loechel Are you still working on this PR or should we close it?

@loechel loechel closed this May 4, 2018
@loechel loechel deleted the flake8_strict branch May 16, 2018 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants