hwiechers
hwiechers

Reputation: 15015

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 Python 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.

Upvotes: 4

Views: 1929

Answers (1)

EMP
EMP

Reputation: 62031

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.)

Upvotes: 3

Related Questions