News for hackers. Stuff that matters.
Re:Writing Python Like Rust by tgv on Thursday June 29, 2023 @02:08PM (#36524387)
You're right, there are none. The link from the GP shows several.

> changing the type _while referring to the same data_ as weakness

Python performs arithmetic and comparison on ints mixed with floats. In other languages, you have to cast those first. It does array subscription on a string. You could even see an expression like 3 * "x" as a type change.

> I can't really think of a dynamic + weak language

It depends on what you call a type, I guess. Is [1, 2] a different type than ["a", "b"]? You can't tell in Python, because there is no type declaration. That makes comparison with polymorphism moot. You can think that the type of b in a + b must be "whatever a's plus operator accepts", but I wouldn't call one or two sanity checks before adding strong typing.

There are no comments on this comment yet.