Backslashes are used for line-continuation. So this:
def test(this, that):
return isinstance(that, something) and \
self.number == that.number and \
self.stuff = that.stuff
Is equivalent to this:
def test(this, that):
return isinstance(that, something) and self.number == that.number and self.stuff = that.stuff
In other words, it's purely for the developer benefit, no practical implication for the code. PEP I think recommends 80 character line width max so use it if you're over that. I should note as well though that you can get away without using \ if you use parenthesis:
def test(this, that):
return (isinstance(that, something) and
self.number == that.number and
self.stuff = that.stuff
)
The pipe '|' is a bitwise 'or' operator. It is a frequently asked question, so there is more info here: https://wiki.python.org/moin/BitwiseOperators