3 ms·
> Yet Ruby and JS manage to do it somehow. Ruby does it by having a mixin (Enumerable) that anything meeting a basic contract (roughly equivalent to the Python
by dragonwriter 5y ago
> Yet Ruby and JS manage to do it somehow.
Ruby does it by having a mixin (Enumerable) that anything meeting a basic contract (roughly equivalent to the Python iterable protocol) can include to get an enormous block of functionality; Python doesn’t have (or at least idiomatically use as freely; ISTR that there is a way to do it) mixins like Ruby does.