Skip to main content

Python but it's Z

Project description

pythonz

pythonz is a package to make your python coding experience more powerful.

example

from functools import partial
from pythonz import pipe, symbol, Maybe

__empty__ = symbol("empty")


def find(fn, itr, default=__empty__):
    try:
        return (
                pipe(itr)
                / partial(filter, fn)
                / next
                // Maybe.just
        )
    except StopIteration:
        if default is __empty__:
            return Maybe.nothing()
        return Maybe.just(default)


# a = pipe(5).and_then(range).then_finally(list) 
a = pipe(5) / range // list  # [0, 1, 2, 3, 4] 
b = find(lambda x: x % 2 == 1, a).unwrap()  # 1
c = find(lambda x: x > 4, a)  # Maybe.None()

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

pythonz-0.2.1.tar.gz (1.3 kB view details)

Uploaded Source

Built Distribution

pythonz-0.2.1-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

Details for the file pythonz-0.2.1.tar.gz.

File metadata

  • Download URL: pythonz-0.2.1.tar.gz
  • Upload date:
  • Size: 1.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.12.5 Darwin/23.6.0

File hashes

Hashes for pythonz-0.2.1.tar.gz
Algorithm Hash digest
SHA256 65e36f6a8c57f1f9d3865b52c03eb8db76f6257f1911415b8c3f69aaeb745d45
MD5 e8d8152a73fc8eedb229a1bc864037d6
BLAKE2b-256 223e904ca8319a357570adec31a3fb3cb836591ac07431f311da13faf7fffef6

See more details on using hashes here.

File details

Details for the file pythonz-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pythonz-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 2.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.12.5 Darwin/23.6.0

File hashes

Hashes for pythonz-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bfe6d2cd172427a75b914aad9b9aa1087d764cf222004886c97a9708f0ad99b
MD5 47b39b225b798dbb6e565b4f2b08357a
BLAKE2b-256 18bf9611bc5dccdfdbd6143166f22a4a82c83b41cfa132100b23f817fec89465

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