tool to check sorting
Project description
is_sorted is a tiny Python tool to check if list (or any iterable) is sorted.
compatible with builtin sorted function
can check multiple keys sorting with custom order
Installation
pip install is_sorted
Examples
A simple way to check sorting
>>> from is_sorted import is_sorted
>>> is_sorted([1, 2, 3, 4, 5, 6])
True
>>> is_sorted([1, 3, 2, 0])
False
>>> is_sorted([5, 4, 3, 2, 1], reverse=True)
True
>>> is_sorted([(1, 2), (2, 0), (3, 10), (3, 9), (4, 5)], key=lambda x: x[0])
True
Multiple keys sorting
>>> data = [(1, 2), (1, 1), (2, 3), (2, 3), (3, 5)]
>>> is_sorted(data, multi=[(lambda x: x[0], False), (lambda x: x[1], True)])
True
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
is_sorted-0.0.2.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file is_sorted-0.0.2.tar.gz
.
File metadata
- Download URL: is_sorted-0.0.2.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aefc31c2ea2add7b56359a88c2415e06c2dc165820b6667d7d6d93cdc2932b8 |
|
MD5 | 43e81886831813b472e465786d412b06 |
|
BLAKE2b-256 | b412ec7dadbbd49a324e2d8190a7f644dc0568c67134ec29f2aac2bc9de6d0d1 |
File details
Details for the file is_sorted-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: is_sorted-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1985e0624b49d8a6996d4d200777e2a8569b9ddbcc5aa9918b94c11bf167a8e |
|
MD5 | 8f56f0681673d45d630ff149a32bc006 |
|
BLAKE2b-256 | 00a94bca7fe9ba60c4faa337e8de258ab427b3f4ff83547f11b3eca973be7c06 |