Mar-05-2019, 03:39 AM
How would I indicate, using a type hint, that the function only works with a
I researched a little deeper and from the documentation, I found:
So a dictionary is not a sequence type, but
Obviously, I would filter out
List
type data structure containing only int
? I researched a little deeper and from the documentation, I found:
Quote:An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict, file objects...
So a dictionary is not a sequence type, but
List
is, so is Sequence
the appropriate type hint?Obviously, I would filter out
str
, and dict
, but I would like a type hint as well.def unpack(sequence_to_unpack : Sequence[int]): passIs the above correct?