A collection of frequently used (mostly functional) utilities not found in the standard library
Project description
Generic-Util
This package contains convenient functions not found in Python's Standard Library (they would mostly fall within itertools, functools, operator, and time). It also contains a variety of convenience functions for the numba JIT compiler library.
See the documentation for details, but functions are grouped as follows:
- Generic_Util.benchmarking: functions covering typical code-timing scenarios, such as a "with" statement context, an n-executions timer, and a convenient function for comparing and summarising n execution times of different implementations of the same function.
- Generic_Util.iter: iterable-focussed functions, covering multiple varieties of flattening, iterable combining, grouping and predicate/property-based processing (including topological sorting), element-comparison-based operations, value interspersal, and finally batching.
- Generic_Util.operator: functions regarding item retrieval, and syntactic sugar for patterns of function application.
- Generic_Util.misc: functions with less generic purpose than in the above; currently mostly to do with min/max-based operations.
Then a sub-package is dedicated to utility functions for the numba JIT compiler library:
- Generic_Util.numba.benchmarking: functions comparing execution times of (semi-automatically-generated) varieties of numba-compilations of a given function, including lazy vs eager compilation, vectorisation, parallelisation, as well as varieties of rolling (see Generic_Util.numba.higher_order).
- Generic_Util.numba.higher_order: higher-order numba-compilation functions, currently only functions to "roll" simpler functions (1d-to-scalar or 2d-to-scalar/1d) over arrays, with a few combinations of input and output type signatures.
- Generic_Util.numba.types: convenient shorthands for frequently used numba (and respective numpy) types, with a focus on C-contiguity of arrays; these are useful in declaring eager-compilation function signatures.
Many functions which would have been included in this package were dropped in favour of using those in the wonderful more-itertools package (and where overlaps remain, there are convenient differences). Separately, although used only in one instance in this repository, the sortedcontainers package is another great source of algorithm-simplifying ingredients.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for generic_util-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a36ca850e482423b2b5ead8946d106edf0329aa9fdc948fd633251681b0e2cb |
|
MD5 | fd3a8211c392eed6a876520ee181d627 |
|
BLAKE2b-256 | 89053485533b43e86ab43f4b316222b92fe72441526cc4ae05791eddd7edf0d2 |