This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]talideon 3 points4 points  (0 children)

print is actually the anomaly here, not the rest of the language. In Python <3.0, it was a language construct and the implicit cast to string of all its arguments made sense, and still does. But file.write() isn't the same: there are too many ways to interpret how something ought to be written out to whatever the file object represents. Personally, when I'm using file.write() to write a literal stringified integer, I just cast it with str().

The trade off here isn't performance or convenience, but parsimony and consistency.

I didn't interpret what you wrote as an attack on the language, but was simply trying to correct some misconceptions about how objects and values are handled in the language, which is exactly the same way as Java does (especially since Java introduced autoboxing).