Bitwise and comparison functions

Bitwise functions operate on the bits of integers or integer arrays since they are universal functions. The operators ^, &, |, <<, >>, and so on have their NumPy counterparts. The same goes for comparison operators such as <, >, ==, and so on. These operators allow you to do clever tricks, which should be good for performance; however, they can make your code quite unreadable, so use them with care.

Get NumPy : Beginner's Guide - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.