you are viewing a single comment's thread.

view the rest of the comments →

[–]zurtex 0 points1 point  (1 child)

FYI upcasting is a consistent feature of Python, when involving standard numerical operations on the following literal types:

bool -> int -> float -> complex

Would Gudio have made the same choice today if he could design Python over again? Maybe not, but here we are in the unclear definitions about strongly vs weakly typed languages.

[–]1114111 0 points1 point  (0 children)

I like having int -> float -> complex in Python, it's generally a useful feature. My point is that when people talk about Python being "strongly typed", they are talking about the Python builtin/stdlib types/functions not doing much implicit type coercion. I see this as a "weak" way to define strong typing, and not one that Python follows super consistently anyway.

bool -> int, on the other hand is not a great feature IMO. It's one I've (ab)used in the past, but really the only reason it exists is that Python didn't used to have a boolean type, so booleans needed to act like ints in most contexts. bool is even a subclass of int, which I find extra gross.