[Python-ideas] Silent bugs - was Re: PEP8 operator must come before line break

Zachary Ware zachary.ware+pyideas at gmail.com
Thu Apr 14 16:41:36 EDT 2016

On Thu, Apr 14, 2016 at 3:30 PM, Erik <python at lucidity.plus.com> wrote:
> However, that doesn't answer my question of when a line consisting of just
> "+ expr" is a useful thing.

It's probably not, but that's for a linter to point out.  For a
stupid, contrived, untested example, though:

class Foo:
    def __init__(self, value):
        self.value = value

    def __pos__(self):
        self.value += 1

    def __neg__(self):
        self.value -= 2

f = Foo(3)
assert f.value == 4
assert f.value == 2


More information about the Python-ideas mailing list