bitwise shift?

mensanator at aol.com mensanator at aol.com
Wed May 2 16:48:12 EDT 2007


On May 2, 2:24 pm, Tobiah <t... at tobiah.org> wrote:
> John Machin wrote:
> > On 26/04/2007 7:10 AM, Sherm Pendley wrote:
>
> >> Shift left is *not* the same as multiplying by k. It is the same as
> >> multi-
> >> plying by 2^k.
>
> > Where I come from, ^ is the exclusive-or operator. Of course YMMV in WV :-)
>
> desktops:toby:ga> bc
> bc 1.06
> Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
> This is free software with ABSOLUTELY NO WARRANTY.
> For details type `warranty'.
> 2^3
> 8

OTOH,

IDLE 1.2c1
>>> 2^3
1

Guess which one is relevant to comp.lang.python?


>
> --
> Posted via a free Usenet account fromhttp://www.teranews.com





More information about the Python-list mailing list