A pure-python list shifter/wrapper
Project description
A pure-python list-shifter/wrapper. Shifts/Wraps an iterable left or right by any amount (modulo to the length of iterable). Can optionally shift the iterable in-place. Create a shifty instance to add these convenience methods to the default list implementation if you prefer.
Why slice when you can shift ‘like-a-boss’ ?!
How do I get set up?
python setup.py install
Dependencies: six
Dependencies (test): Coverage, nose
How to run tests: ./runtests.sh
Deployment instructions: pip install shifty
Contribution guidelines
I accept pull requests.
What about test coverage?
There is a full suite of unit-tests.
Who do I talk to?
Francis Horsman: francis.horsman@gmail.com
Example
>>> from shifty import shift_left, shifty >>> a = [1, 2, 3, 4] >>> b = shift_left(a, 3) >>> b [4, 1, 2, 3] >>> assert a is not b >>> b = shift_left(a, 2, in_place=True) >> assert a is b >>> b = shift_left(a, 5) >>> b [4, 1, 2, 3]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shifty-1.0.7.tar.gz
(10.3 kB
view hashes)
Built Distribution
shifty-1.0.7-py2.py3-none-any.whl
(12.9 kB
view hashes)
Close
Hashes for shifty-1.0.7-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6aad71f7c57235998578fdf742ce4c9c2e31364ced54611258c2a4f7771fab6 |
|
MD5 | e10a78b8bea6ee23d0122ff7e055f536 |
|
BLAKE2b-256 | a23634cd35504460b3f7616ae63fcba96778d26ef5baf1938be85abfc1f2d910 |