4 ms·
I use typed arrays in Python when I need to store a lot of data in memory, and the overhead of objects would be too large (for example I built a little library
by ant6n 11y ago
I use typed arrays in Python when I need to store a lot of data in memory, and the overhead of objects would be too large (for example I built a little library that can load a country's worth of openstreetmap data).
What I really miss is typed dictionaries (int -> int).
- rauschma 11y agoI don’t think there’ll ever be typed dictionaries (which are a fairly high-level data structure). There is, however, a proposal for typed objects: https://github.com/dslomov/typed-objects-es7 https://github.com/dslomov/typed-objects-es7
- ant6n 11y agoWell, one could build a typed object-array library using typed arrays (i.e. use one typed array for every member). This actually gives me an idea... :P But you wouldn't want to rebuild a dict using integer arrays, that would be pretty slow.