Python‎ > ‎operator‎ > ‎

operator.and_()


Return
It is a built-in function and operator returns bitwise of a & b.

Syntax
operator.and_(a,b)
__add__

Parameters
a,b=number

Import module
Importing module is required in the Shell window and the Editor window.

Examples
The method return the bitwise of a & b.
>>>import operator
>>> operator.and_(3,4)

0
>>> operator.and_(3,3)
3
>>> operator.and_(3,2)
2

operator.__and__(a, b)
Return same value as operator.add(a,b).
 >>> operator.__and__(3,2)
2
>>> operator.__and__(1,0)
0
>>> operator.__and__(0, -1)
0

The value added in pow() and operator.ipow():
 >>> import operator
>>> a=operator.ipow(3,4)
>>> b=pow(3,4)
>>> a.__add__(b)
162

Comments