开发者

When does Python do automatic type conversion?

When does Python do automatic type conversion?

--

Update:

I asked this after reading this post: In praise of Go or : "Why I moved from Pytho开发者_运维技巧n and C++ to Go". The one of the points the poster makes is that:

  • It is statically typed, so it is more explicit and the code of a third party is more readable. Also it eliminates the risk of unwanted automatic type conversions (unlike Python).

I had no idea what he meant by "unwanted automatic type conversions". Now, I think he's talking about implicit numeric conversions. Of course, Python has these as 1.0 + 2 will convert 2 to 2.0 and return 3.0.


It doesn't - it has duck typing instead.

(I may have misunderstood what you meant by automatic type conversion, though, so it would help if you give more detail in your question.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜