DEV Community

Discussion on: What would you want the most in Python 4?

Collapse
 
sonnk profile image
Nguyen Kim Son

I think the function here is rather canConvertToInt (or can_convert_to_int according to PEP8 😅).
The int(val) works for both val=1 and val="1". If you want simply to test whether a variable is int, type(val)==int should be enough.