Operator Functions

operator.lshift()

Shift integer bits left; negative shift counts raise ValueError. Equivalent to a << b; custom operand types control the result.

Formal Syntax & Structure

python syntaxpython
operator.lshift(a, b, /)

Parameters & Attributes

NameTypeDescription
aobjectLeft operand or target object.
bobjectRight operand.

Return Value

object

The object result described above.

Working Example

Example Snippetpython
import operatorprint(operator.lshift(3, 2))
Python Reference