I want to use random.shuffle
to randomize a list of strings. Here is a minimal example code:
import random
L = ['a', 'b']
random.shuffle(L, 3.0)
However, my IDE complains about the second argument. It highlights 3.0
with the following warning message:
Expected type 'Optional[() -> float]', got 'float' instead
What is this warning supposed to mean?
From the docs for random.shuffle
random.shuffle(x[, random])
Shuffle the sequence x in place.
The optional argument random is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function
random()
.
(added bold)