3 ms·
I wouldn't call it awful, but it is slightly annoying. In a dynamically typed language it's hard to know apriori if a variable is an int or a float with a whole
by dagw 9y ago
I wouldn't call it awful, but it is slightly annoying. In a dynamically typed language it's hard to know apriori if a variable is an int or a float with a whole number value and you end up having to write x/float(y) all over the place just to make sure your code does what you want it to do.
The new case of / always being float division and // always being integer division just makes everything more explicit.
- OskarS 9y agoThis particular language quirk I don't think has anything to do with dynamic typing: it's equally annoying in C-style languages where 3/2 and 3/2.0 mean different things.
- dagw 9y agosure, but in C if you have a line that looks like z = 3/y you'll know that y is either always a float or always an int depending on its type and thus you'll 'know' what z is.