Website hosting and domain hosting service by

 Back to Index

5.7 Shifting operations

The shifting operations have lower priority than the arithmetic operations:


shift_expr  ::=  a_expr | shift_expr ( "" | "" ) a_expr
Download entire grammar as text.

These operators accept plain or long integers as arguments. The arguments are converted to a common type. They shift the first argument to the left or right by the number of bits given by the second argument.

A right shift by n bits is defined as division by pow(2,n). A left shift by n bits is defined as multiplication with pow(2,n); for plain integers there is no overflow check so in that case the operation drops bits and flips the sign if the result is not less than pow(2,31) in absolute value. Negative shift counts raise a ValueError exception.




2002-2004 Website Hosting Service


Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to offers cheap domain registration, domain name transfer and domain search services   Cheap domain name - Cheap domain name registration service including free domain hosting services  

Domain registration : Buy domain name or register domain name from $5.95/year only