Pipe in the "return" statement

Oliver Bestwalter oliver at bestwalter.de
Mon Jul 25 10:35:06 EDT 2011


Hello Archard,

On 25.07.2011, at 16:16, Archard Lias wrote:

> On Jul 25, 2:03 pm, Ian Collins <ian-n... at hotmail.com> wrote:
>> On 07/26/11 12:00 AM, Archard Lias wrote:
>> 
>>> Hi,
>> 
>>> Still I dont get how I am supposed to understand the pipe and its task/
>>> idea/influece on control flow, of:
>>> return<statement>  |<statement>
>>> ??
>> 
>> It's simply a bitwise OR.
>> 
>> --
>> Ian Collins
> 
> Yes, but how does it get determined, which one actually gets returned?

You do a Bitwise OR with numbers. Your statements are both returning numbers and those are combined with a bitwise OR. Combining b0001 with b0010 results in 0011 for example, you can see this very often done in C Code to set and check flags. Here is a gentle introduction:

http://www.codeproject.com/KB/tips/Binary_Guide.aspxhttp://www.codeproject.com/KB/tips/Binary_Guide.aspx

Cheers
Oliver




More information about the Python-list mailing list