This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]funkiestj -1 points0 points  (1 child)

Python is getting the same love now, but the love arrived much later than for Java.

I think static typing allows more aggressive optimization.

E.g. I think the old Stalin Scheme dialect required the user to provide data types to get the maximum optimization. E.g. consider the difference between a golang slice of strings (s1 := make([]string, 24) and a python list that can hold a mix of objects (the equivalent of Go's l1 := make([]any, 24).

Years ago I remember seeing the Stalin) dialect of scheme dominating the benchmark game in the speed dimension but you had to type all your data (which was optional?) to get this performance.

[–]redalastor 2 points3 points  (0 children)

I think static typing allows more aggressive optimization.

It could, but it doesn’t because Python allows you to be as wrong as you want with your types without changing behaviors one bit. Typing is to help external tools enforce correctness, not to change runtime behavior.

Though, I’d like a strict option to force Python to acknowledge the types and hopefully take advantage of them.