4 ms·
In Python you can subclass builtin types and override __new__. Not every method can be subclassed with success, though, because of optimizations. I agree it's
by alanfranzoni 9y ago
In Python you can subclass builtin types and override __new__. Not every method can be subclassed with success, though, because of optimizations.
I agree it's the way to go, though. My typical tiny type in Python just has preconditions on string content.