pycryptodome
pycryptodome copied to clipboard
Annotate Crypto.Random.random.choice generically
Crypto.Random.random.choice
return type was defined as object
, which is
restrictive. All operations on return values must be cast to the
appropriate type in order to avoid an error.
Here we replace the input Sequence
with Sequence[T]
for some type
variable T
and return type T
. This assumes the input is homogeneous, but
it can still be generic (i.e. a Union[...]
type) and is less
restrictive than assuming object
.