Pipe in the "return" statement

gwowen gwowen at gmail.com
Mon Jul 25 10:42:08 EDT 2011


On Jul 25, 3:16 pm, Archard Lias <archardl... at googlemail.com> wrote:

> Yes, but how does it get determined, which one actually gets returned?


It's a bit-wise or, not a logical or so what get returns is a
combination of the two results.  The n-th bit of the return value is 1
if the n-th bit of either (or both) of the two statements

(Fixed width font)
a     1 1 0 0 0 1 1 1 0 0 1 0 1 ...
b     0 1 0 1 0 0 1 0 0 0 0 1 1 ...
a|b   1 1 0 1 0 1 1 0 0 0 1 1 1 ...
(/Fixed width font)



More information about the Python-list mailing list