I'm having a hard time trying to fix this piece of code in order for it to fit PEP8's guidelines. I have tried breaking the line with a backslash and then enclosing it with a set of brackets. Furthermore, I made sure that the second line came right after the position first right bracket.
if (len(self._stools[origin]) > 0 and len(self._stools[dest]) and
self.top_cheese(origin).size > self.top_cheese(dest).size):
raise IllegalMoveError
Thus, every time I run pep8.py on this piece of code I get:
TOAHModel.py:94:14: E127 continuation line over-indented for visual indent.
I'm guessing you are getting a "Continuation line does not distinguish itself from next logical line". The solution is to move the second line another indent -
if (len(self._stools[origin]) > 0 and len(self._stools[dest]) and
self.top_cheese(origin).size > self.top_cheese(dest).size):
raise IllegalMoveError
The reason is that self.top_cheese(origin).size
is at the same indent level as raise IllegalMoveError
, which can be difficult for the reader, because it might is not obvious where the if statement ends and the actual block within the if statement begins. You can argue that this does not look much better, but that's the way it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With