On Thu, Oct 2, 2014 at 11:24 PM, Didymus <lynt...@gmail.com> wrote: >>>> errors = False >>>> errors |= 3 >>>> errors > 3 >>>> errors |= 4 >>>> errors > 7 > > The '|=' operator, I read should be like a = a | b, but this appears to > add the two numbers as long as it's more than the previous: > >>>> errors |= 5 >>>> errors > 7
It is indeed (mostly) equivalent to "a = a | b". Do you understand what bitwise 'or' does? When you use False there, it's equivalent to zero. Everything after that is straight-forward bitwise or. http://en.wikipedia.org/wiki/Bitwise_operation#OR ChrisA -- https://mail.python.org/mailman/listinfo/python-list