Skip to main content

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’ ?!

Codeship Status Build Status Downloads Latest Version Supported Python versions Development Status Wheel Status Egg Status Download format License

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.8.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

shifty-1.0.8-py2.py3-none-any.whl (12.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file shifty-1.0.8.tar.gz.

File metadata

  • Download URL: shifty-1.0.8.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for shifty-1.0.8.tar.gz
Algorithm Hash digest
SHA256 e1234a289a65e3b51bff19afb7178abe74194096e8fd13745c45915d2089b2ca
MD5 21bd61b7ca804509c00c77dbbb6a3250
BLAKE2b-256 0bc54166223d0606e197c9a36be3cc4684bb0f0dde0c51295317eff8bc925422

See more details on using hashes here.

File details

Details for the file shifty-1.0.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for shifty-1.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6f416b0f52a7cca7f8c777376c3203cceff5523eb63cc2214a3d37e37c1b145f
MD5 b4ab6e7b00775583578d71b7fe5a0181
BLAKE2b-256 59e44238a7d081398b19ecb1599c6a9fc59e11b9360023a2450b331f0dac24ca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page