We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.


The left shift operator accept plain or long integers as arguments. The arguments are converted to a common type. It shifts the first argument to the left by the number of bits given by the second argument.

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.

To support this operator in your own classes, implement the __lshift__ method.