1 Réponse
+ 4
Both samples do the same thing, in the first one the operator is used.
The same code is one line shorter.
These are the samples:
a = [1, 2, 3, 4, 5, 6, 7, 1, 3, 5, 5, 3, 4]
if (n := len(a)) > 10:
print(n)
b = [1, 2, 3, 4, 6, 7, 1, 3, 5, 5, 3, 4]
m = len(b)
if (m > 10):
print(m)