28 ms·
Calling __slots__ a language/object feature is a crutch. It was made a language feature based on how CPython implements objects with a __dict__ field showing th
by __s 9y ago
Calling __slots__ a language/object feature is a crutch. It was made a language feature based on how CPython implements objects with a __dict__ field showing the backing dictionary. Also there's the 'is' operator which has unspecified behavior with integers/strings due to integer-cache & string interning. If you used unboxed integers then 'is' would likely work as equals for all integers that weren't bignums. Python's tried to define a standard outside CPython's details, but CPython is essentially de facto, so for serious implementations it's details are important to follow. Similar thing happened with clang needing to implement many GCC C extensions
Ordered dict layout: https://mail.python.org/pipermail/python-dev/2016-September/146489.html https://mail.python.org/pipermail/python-dev/2016-September/...