If all python had was __slots__ then we would not be struggling to JIT python.
Tight numerical loops is where the JIT adds performance.
Most performance sensitive features are already available in python between numpy, numba and Cython without really leaving the language core.
You'll mostly be speeding up the slow parts of python, not supercharging the fast parts.
[–] hermitdev 2 days ago
[–] samatman 2 days ago
[–] sakesun 2 days ago
>>> Dog.__bases__ = (Cat,)
>>> isinstance(dog, Dog)
True
>>> isinstance(dog, Cat)
True
>>>[–] gregdeon 2 days ago
[–] esprehn 2 days ago
See also the warning here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
And this related article:
[–] mirashii 2 days ago
[–] lefra 1 day ago
Modifying a variable that is read by another thread needs special care in all multithreaded languages I know. If you don't use a synchronization primitive to tell the other thread "hey, this thing here may have changed, read it again from memory"; the other thread is free to use its old value for as long as it whishes.
[–] pjmlp 2 days ago
[–] cpburns2009 2 days ago
[–] hinkley 2 days ago
I saw this presented as new tech at either OOPSLA or OSCon almost exactly 20 years ago.
CPU branch prediction is still pretty good even with the loss of function in recent years.
Heh, how about how `__class__` works? Not that I recommend actually doing this, but you can literally change the type of an already instantiated object by reassigning `__class__`: