![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
Where in PEP 8 does it violate its own advice? That's a bug. (The PEP has many authors by now.) As the PEP acknowledges, style is hard to agree over. It's even harder to change an agreement that has been documented (if not always followed consistently) for over 20 years. My rationale for this rule is that ending a line in a binary operator is a clear hint to the reader that the line isn't finished. (If you think about it, a comma is a kind of binary operator, and you wouldn't move the comma to the start of the continuation line, would you? :-) On Thu, Apr 14, 2016 at 9:25 AM, SW <walker_s@hotmail.co.uk> wrote:
Hi, PEP8 says that: "The preferred place to break around a binary operator is after the operator, not before it."
This is ignored in the multiline if examples, and seems to generally be a bad idea as it negatively impacts clarity.
For example, the following seems much clearer as the entire line does not need to be scanned to see the intent- only the start of the line is needed to see how the different properties are used for filtering: mylist = [ item for item in mylist if item['property'] == 2 and item['otherproperty'] == 'test' ]
The alternative seems less clear: mylist = [ item for item in mylist if item['property'] == 2 and item['otherproperty'] == 'test' ]
If this recommendation remains in force, it would be good to: 1. Follow it in the style guide. 2. Provide a rationale for it, as currently it seems arbitrary and unhelpful.
Just raising this as it has bitten me a couple of times with style checkers recently.
Thanks, S
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)