Bitwise Operators in Python

I completed the “Bitwise Operators in Python” intermediate-level tutorial offered by Real Python. The instructor of the tutorial is Bartosz Zaczyński. In this tutorial I learned how to: • Use Python bitwise operators to manipulate individual bits • Read and write binary data in a platform-agnostic way • Use 6 techniques of bitmasks to pack information on a single byte • Overload Python bitwise operators in custom data types • Bitwise with Numpy, Pandas, SQLAlchemy modules • Big-Endian vs Little-Endian • How computers use the binary system to represent different kinds of digital information • Different ways to interpret bits and how to mitigate the lack of unsigned data types in Python • Python’s unique way of storing integer numbers in memory You can find this tutorial at · https://realpython.com/python-bitwise-operators/ One of my favorites are: • Check if a value is odd or even by using & 1 operator: ('even', 'odd')[n & 1] • Check if a number is a power of two: (n != 0) and (n & (n-1) == 0) In the future, I can experiment using bitwise operators to implement algorithms such as compression, encryption, and error detection or elsewhere.

Our Sidebar

You can put any information here you'd like.

  • Latest Posts
  • Announcements
  • Calendars
  • etc