DEV Community

Cover image for Array: Swiss-army-knife of Python sequences
Lauriat
Lauriat

Posted on

Array: Swiss-army-knife of Python sequences

github & pypi & docs & HN

I released a package that extends the functionality of the Python built-in list - maybe others will find it useful. I often found myself writing the same code snippets for manipulating lists (e.g. flattening, grouping, and element-wise operations) and figured I might as well make a library that contains all the essentials. Many of the methods are wrappers for built-ins, but I find the syntax of Arrays cleaner than the weirdness of the builtins and you won't be needing to google for the 100th time whether reduce is in the itertools or functools module.
Array provides

  • basic mathematical operations (add, mul, eq, etc.)
  • chainable functional methods (map, filter, reduce, etc.)
  • basic “numpy” methods (clip, argsort, split, linspace, etc.)
  • parallel execution (parmap, asyncmap, etc.)
  • multidimensional indexing
  • list built-ins
  • & more

Cheers!

Top comments (0)