Python __rxor__() Magic Method

Syntax object.__rxor__(self, other) The Python __rxor__() method implements the reverse Bitwise XOR ^ operation with reflected, swapped operands. So, when you call x ^ y, Python attempts to call x.__xor__(y). If the method is not implemented, Python attempts to call __rxor__ on the right operand and if this isn’t implemented either, it raises a TypeError. … Read more

Python __xor__() Magic Method

Syntax object.__xor__(self, other) The Python __xor__() method implements the built-in Bitwise XOR ^ operation. So, when you cal x ^ y, Python attempts to call x.__xor__(y). If the method is not implemented, Python first attempts to call __rxor__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call this … Read more

Pandas loc() and iloc() – A Simple Guide with Video

In this tutorial, we are covering the Pandas functions loc() and iloc() which are used for data selection operations on dataframes. By using the loc() function, we access a group of rows and/or columns based on their respective labels, whereas the iloc() function is an integer-location-based way to access these groups. Getting values with the … Read more

Python Dictionary: How to Create, Add, Replace, Retrieve, Remove

Python defines the dictionary data type as an unordered collection that contains key:value pairs. The key:value pairs (separated by commas) are wrapped inside curly braces ({}). Β  Each key inside the dictionary must be unique and immutable. Dictionary keys can be one of the following data types: integer, string, or tuple. Dictionary keys can not … Read more

How to Use Mock in PyTest?

In unit tests, you would want to focus on the code you want to test and avoid dealing with external dependencies that your code might be using. Or, your program might have external dependencies that are not available at the time of the test. In these situations, you can use mocks in your tests. This … Read more

Python __and__() Magic Method

Syntax object.__and__(self, other) The Python __and__() method implements the built-in Bitwise AND & operation. So, when you cal x & y, Python attempts to call x.__and__(y). If the method is not implemented, Python first attempts to call __rand__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call this … Read more

Earn Passive and Active Income ($200/h) as a Chainlink Validator and Freelance Consultant

Just stumbled upon this opportunity and freelancing niche that could be highly profitable in the Blockchain industry, fun, and sustainable for decades to come. Do you want to grab this opportunity? References from the video: Official website Chainlink: https://chain.link/ Run a Chainlink node: https://docs.chain.link/docs/running-a-chainlink-node/ The gap — nobody on Upwork offers their focused Chainlink services: … Read more

Python __rshift__() Magic Method

Syntax object.__rshift__(self, other) The Python __rshift__() method implements the built-in >> operation. So, when you cal x >> y, Python attempts to call x.__rshift__(y). If the method is not implemented, Python first attempts to call __rrshift__ on the right operand and if this isn’t implemented either, it raises a TypeError. We call this a “Dunder … Read more