cmpGen is deprecated. Please just use the “key” parameter of sort/sorted instead. It is better in every conceivable way (faster, simpler, more legible, etc.)
For example, here is the example below, but entirely using “key” instead:
l=[3,0,1,-2,4,3,-5] l.sort(key=abs) l now is [0,1,-2,3,3,4,-5]
This pakage is now here just to support legacy version of packages that used this
Old README for reference:
cmpGen is a very simple utility to aid in sorting. Basically, I often want to sort a list based on a specific property or more generically a function of the values in the list. cmpGen acts as a middle layer to make this process simple.
Usage: l is a list l.sort(cmpGen(someFunctionThatActsOnListElements))
Example 1: Sort a list of 2-integer pairs based on second element in the pair: l=[[3,3],[1,6],[0,12],[1,1],[7,4],[6,7]] l.sort(cmpGen(lambda x: x[1])) l is now [[1, 1], [3, 3], [7, 4], [1, 6], [6, 7], [0, 12]]
Example 2: Sort based on the absolute value of list elements: l=[3,0,1,-2,4,3,-5] l.sort(cmpGen(abs)) l now is [0,1,-2,3,3,4,-5]
Metadata
Release files for cmpGen 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cmpGen-0.2.tar.gz | 18.1 kB | Without provenance | Details |
Release files / cmpGen-0.2.tar.gz
| Download URL | cmpGen-0.2.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df6d4a7f15fb13b9e509c69226205aa22b3d63b021ebf072d215fb4bf8533b81
|
|
BLAKE2b-256 checksum How to use checksums |
2479b678898369767ec7330cf8dace289dcf4ee3efbe87125a1bfe7563978212
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for cmpGen 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.