News for hackers. Stuff that matters.
Re:What the Fuck Python by kazinator on Sunday July 20, 2025 @12:45PM (#44626889)
The difference between implicit conversion and explicit is just syntactic sugar: do you have to put some visible tokens into the code to allow a conversion to happen, or not.

Implicit conversion can be seen as the compiler deciding among several possible conversions (or possibly just one) and inserting the coercion/casting operator into the intermediate code to make it happen.

(Of course, this can be a run-time decision based on dynamic types also, but the reasoning is the same. E.g. the run-time sees that a plus operation is adding an integer and float, and can either signal an error (requiring the program to be repaired by inserting a conversion operation into the expression), or just do that conversion, like the integer operand to float.

Re:What the Fuck Python by shakna on Sunday July 20, 2025 @04:49PM (#44629185)
I really wouldn't call something you need to write, to make something happen, "syntactic sugar".

Otherwise types are just sugar. Indicies are just sugar. Lists are just sugar.

Re:What the Fuck Python by fc417fc802 on Friday July 25, 2025 @03:40PM (#44687446)
It's the other way around. Implicit conversion is syntactic sugar for explicit conversion. Sugar is anything that is functionally identical, just notated more conveniently.

That said, I think you're correct about the casting versus conversion distinction. Languages frequently overload established terminology with slightly modified variants and it's incredibly confusing.