+ 1
List[int] in python
https://code.sololearn.com/czAIgGgL4jka/?ref=app if List[int] doesn't restrict the list to have only integers, what else does it do?
5 Respostas
+ 5
isinstance() or type()
If I'm correct isinstance() returns also True for subclasses. Type() not.
https://stackoverflow.com/questions/152580/whats-the-canonical-way-to-check-for-type-in-JUMP_LINK__&&__python__&&__JUMP_LINK
+ 3
It is a type annotation, that hints the user how to provide input. IT DOES NOT DO TYPE-CHECKING.
+ 2
0
Lisa is there any inbuilt way to do type-checking?
0
List=[Aman,saurav,Aman]
Print(list)