pycryptodome icon indicating copy to clipboard operation
pycryptodome copied to clipboard

Annotate Crypto.Random.random.choice generically

Open fionn opened this issue 3 years ago • 0 comments

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.

fionn avatar Mar 28 '21 09:03 fionn