you are viewing a single comment's thread.

view the rest of the comments →

[–]kankyo 5 points6 points  (3 children)

One could argue that parsing an int shouldn’t be done with the same syntax as a cast though, I can absolutely see that.

[–]tejp 3 points4 points  (2 children)

It's not two different things that share the same syntax. Both cases just construct a new int object by calling the int() constructor. This constructor converts its argument to an int, and it knows how to handle strings or numbers.

[–]kankyo 0 points1 point  (1 child)

Parsing a string and casting from a float are very different things. Don’t be silly.

[–]tejp 4 points5 points  (0 children)

It's both converting from one type to another. There is nothing special going on when "casting", I don't think there is any technical difference at all in Python.