Join the Discord channel for live tech support!
GrailSort for Python
GrailSort for Python is a Python API for the GrailSort algorithm.
Installation
You can install GrailSort for Python from source:
$ git clone https://github.com/gaming32/grailsort
$ cd grailsort
$ python setup.py install
Or you can install it from PyPI:
$ python -m pip install GrailSort
Usage
GrailSort for Python comes with two modules: a strict one, and a slower one. The strict module (cGrailSort) only deals with array.array('d') objects, while the slower module (grailsort) deals with any Python sequence that contains comparable objects.
It is generally unnescessary to deal with the grailsort module, as you might as well use the built-in list.sort method or the sorted function. However, TimSort is not in-place, while GrailSort is. cGrailSort is useful when you need to sort with speed.
Example
grailsort
import grailsort
import random
def print_out_of_order_index():
index = next((i for i in range(len(l) - 1) if l[i] > l[i + 1]), None)
print('Out of order index:', index)
l = list(range(1024))
print_out_of_order_index()
random.shuffle(l)
print_out_of_order_index()
grailsort.grailsort(l)
print_out_of_order_index()
cGrailSort
import cGrailSort
import array
import random
def print_out_of_order_index():
index = next((i for i in range(len(a) - 1) if a[i] > a[i + 1]), None)
print('Out of order index:', index)
a = array.array('d', range(1024))
print_out_of_order_index()
random.shuffle(a)
print_out_of_order_index()
cGrailSort.grailsort(a)
print_out_of_order_index()
Release files for GrailSort 1.2.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 | |
|---|---|---|---|
| GrailSort-1.2.2.tar.gz | 140.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| GrailSort-1.2.2-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details |
| GrailSort-1.2.2-cp38-cp38-win_amd64.whl | CPython 3.8 | CPython 3.8 | Windows x86-64 | Details |
| GrailSort-1.2.2-cp38-cp38-manylinux1_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.5+ x86-64 | Details |
| GrailSort-1.2.2-cp37-cp37m-win_amd64.whl | CPython 3.7 | CPython 3.7 pymalloc | Windows x86-64 | Details |
Total release size: 924.1 kB
Release files / GrailSort-1.2.2.tar.gz
| Download URL | GrailSort-1.2.2.tar.gz |
|---|---|
| Size | 140.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91c9757cfb55d2be0856794a4d5ee05684aa5d8725f7a887212af2f69741999e
|
|
BLAKE2b-256 checksum How to use checksums |
42f09242784eeb26e32c8c5dfaa7d2dcdb968fcc9dd8ed32fca80d9d76c6d0c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
|
Release files / GrailSort-1.2.2-cp39-cp39-win_amd64.whl
| Download URL | GrailSort-1.2.2-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 103.6 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8f53bb11598f7ad91f9f24605c2ef99f2878cacac7899b24e80b7339d02a0ed3
|
|
BLAKE2b-256 checksum How to use checksums |
c1ac3a443cd1b2bdb10ce2bac8a15c394ff9c451b026291a65c0b956b8d054aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
|
Release files / GrailSort-1.2.2-cp38-cp38-win_amd64.whl
| Download URL | GrailSort-1.2.2-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 103.8 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
69e69bed6bb7152a37e837c143f115751a65bfa303c30c877ded08e921257fc7
|
|
BLAKE2b-256 checksum How to use checksums |
bea6f8d5a92df312d2f5addcaa54b2854839665c9f705330434b01ba342cff46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
|
Release files / GrailSort-1.2.2-cp38-cp38-manylinux1_x86_64.whl
| Download URL | GrailSort-1.2.2-cp38-cp38-manylinux1_x86_64.whl |
|---|---|
| Size | 473.5 kB |
| Tags | CPython 3.8 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
17872b62e64434f3a73980bf00f8be11dd0045892fb740716a5dc02614e43c93
|
|
BLAKE2b-256 checksum How to use checksums |
01075e54a6b7f22c6a29c77e68756575fddf09b14e6516f3e865a5113857e4c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
|
Release files / GrailSort-1.2.2-cp37-cp37m-win_amd64.whl
| Download URL | GrailSort-1.2.2-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 102.8 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3ccbe6786fc67ad7d7c2e13a6dc7f46c960180c15150f629dd238a0ca3bbfc49
|
|
BLAKE2b-256 checksum How to use checksums |
e0142b233982832205874739806a4df0b2413afeb5dc67892feae97a6dd4303b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
|