|
|
|
|
|
by tmh88j
340 days ago
|
|
> There's no type casting in Python. int(), float() and bool() just create objects of their respective types, passing the arguments to the initializer int() and float() behave like type casting, bool() does not. It's a truthiness check that would be more aptly named istruthy(). In python non-empty strings are truthy, so providing any string except for "" to bool() will return True, including "False". |
|
What you're reaching for is type conversion. Some languages have "implicit conversion" when casting, but the word itself doesn't require it.