Skip to main content

Using isinstance for a list of bools / ints

I have a list of ints,

lst = [1, 2, 3]

how do I do a isinstance on this, to return True only for a list of ints?

isinstance(lst, list[int]) # does not work


source https://stackoverflow.com/questions/74175849/using-isinstance-for-a-list-of-bools-ints

Comments