...

/

More of These

More of These

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).

Press + to interact
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 onwards, you can use a typical f-string syntax like f'{some_var=} for quick debugging.

⚠️ The following code is meant for Python 3.8 specifically.

Press + to interact
some_string = "ftwpython"
print(f'{some_string=}')

Python uses 2 ...

...