Python really needs to take the Typescript approach of "all valid Python4 is valid Python3". And then add value types so we can have int64 etc. And allow object refs to be frozen after instantiation to avoid the indirection tax.
Sensible type-annotated python code could be so much faster if it didn't have to assume everything could change at any time. Most things don't change, and if they do they change on startup (e.g. ORM bindings).
That was how the Mojo language started. And then soon after the hype they said that being a superset of Python was no longer the goal. Probably because being a superset of Python is not a guarantee for performance either.
> Python really needs to take the Typescript approach of "all valid Python4 is valid Python3"
It is called type hints, and is already there. TS typing doesn't bring any perf benefits over plain JS.
There will be not Python 4, and 3.X policy requires forward compat, so we are already there.
But that's just not what python is for. Move your performance-critical logic into a native module.
Isn't rpython doing that, allowing changes on startup and then it's basically statically typed? Does it still exist? Was it ever production ready? I only once read a paper about it decades ago.
I think sadly a lot of Python in the wild relies heavily, somewhere, on the crazy unoptimisable stuff. For example pytest monkey patches everything everywhere all the time.
You could make this clean break and call it Python 4 but frankly I fear it won't be Python anymore.
Oh, and while we're at it, fix the "empty array is instantiated at parse time so all your functions with a default empty array argument share the same object" bullshit.
> Python really needs to take the Typescript approach of "all valid Python4 is valid Python3
Great idea, though I don't think they learned anything from the Python 2 to 3 transition so I wouldn't hold my breath.
To clarify, it is nuts that in an object method, there is a performance enhancement through caching a member value.