Bitwise operators. Differences from javascript and PHP.

Fredrik Lundh fredrik at pythonware.com
Fri Nov 17 11:08:59 CET 2006


skorobogatov at gmail.com wrote:

> I can't understand a little thing in bitwise operations.
> 
> In PHP and Javascript
> 4653896912>>13 = -212992
> 
> In Python and Ruby
> 4653896912>>13 = 568102
> 
> In Python and Ruby - it's ok. I understand.
> But i need to get in Python same value as in PHP and Javascript.

hint:

 >>> 4653896912 > sys.maxint
True

not sure what PHP is doing with that expression, really.

</F>




More information about the Python-list mailing list