Search⌘ K
AI Features

More of These

Explore various Python features including the matrix multiplication operator @, enhanced f-string debugging, the limits of local variable storage, Python's Global Interpreter Lock affecting threading, and how output buffering impacts the print function. Understand how these elements influence your Python code behavior and performance.

We'll cover the following...

1.

Since we are talking operators, there’s also the @ operator for matrix multiplication (don’t worry, this time it’s for real).

Python 3.5
import numpy as np
print(np.array([2, 2, 2]) @ np.array([7, 8, 8]))

Explanation

The @ operator was added in Python 3.5, keeping the scientific community in mind. Any object can overload the __matmul__ magic method to define behavior for this operator.


2.

From Python 3.8 ...