Skip to main content

Immutable manipulation of Python data structures, Clojure style

Project description

pyclo

Pyclo is a collection of functions for Python named after the Clojure standard library to perform the equivalent operation of the respective Clojure function.

Install with

pip install pyclo

Rationale

While immutability is neither idiomatic nor common in Python, it is still beneficial to implement the concept through engineering discipline. However, soon one will find oneself writing the same constructs over and over again, and even though these expressions are fairly succinct, it is much nicer to refer to them by name. The goal of this library is to provide a collection of functions that promote immutable manipulation of standard Python data structures as a concept without strictly enforcing it.

They say that there are only two hard problems in software engineering, one of them being naming. Clojure is chosen as a source of inspiration for these functions because the author of this library considers Clojure's naming the gold standard.

Reference

from pyclo import *
  • dissoc(dict, *keys) - return a copy of dict without specified keys.
  • select_keys(dict, *keys) - return a copy of dict only containing keys.
  • get_in(dict, keys, default=None) - look up a sequence of keys in a nested dict.

Development

make test
make lint
make upload  # upload to Pypi

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

pyclo-0.1.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

pyclo-0.1.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file pyclo-0.1.0.tar.gz.

File metadata

  • Download URL: pyclo-0.1.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.6

File hashes

Hashes for pyclo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2dfd4887b108447d8b0b1abc7a3149671e311fc7d80723c33385bd21301b979e
MD5 7700f8122182abdbd288f0d37de5b867
BLAKE2b-256 86fe8db2039da857baa517fbc27f4482eba459ab33a50d692a0e3a898c6cd42c

See more details on using hashes here.

File details

Details for the file pyclo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyclo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.6

File hashes

Hashes for pyclo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faf6511e713858939f5fd89808c23f6f5e69c805496f81d951039537c674f741
MD5 e3cfe84bb0b0eae0f41d5596ef52d44e
BLAKE2b-256 bc6a6228e0a5e51af06a637262a01c5e5fd124dc75c36c4b0d2011edd1c27c03

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