4 ms·
If you want Python to "be smart enough to cast x automatically", then you want a weakly typed language. Weakly typed languages are difficult to reason about.
by vomjom 17y ago
If you want Python to "be smart enough to cast x automatically", then you want a weakly typed language. Weakly typed languages are difficult to reason about.
For example, should "3" == 3? Should 3 automatically be converted to "3" in that instance, or vice-versa?
Anyway, a better solution is:
print "x: %s" % x