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

__empty__ = symbol("empty")

class FindFailed(StopIteration): ...

def find(fn, itr, default=__empty__):
    try:
        return (
                pipe(itr)
                / partial(filter, fn)
                // next
        )
    except StopIteration as e:
        if default is __empty__:
            raise FindFailed() from e 
        return 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)  # 1
# c = find(lambda x: x > 4, a)  # FindFailed

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

Uploaded Source

Built Distribution

pythonz-0.1.1-py3-none-any.whl (1.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythonz-0.1.1.tar.gz
  • Upload date:
  • Size: 1.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.17.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for pythonz-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d8e516ce753d5de47b22d20f4cff05415a57cbf7157b5ba3812d942e304bdf4a
MD5 06cb5a9c12836debcc18eeea984b4d69
BLAKE2b-256 34f36cfe3d432edd908cf9425b86d7fe6b0f610e9139f2e1e0ce76b7b0ad87df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythonz-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 1.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.17.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for pythonz-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6fad4d1eaf16345f0cd1221a6e870e5ac52fb009444af3dc5652cf2199295b
MD5 8e53c999aa41e03c709088fb36cb88dc
BLAKE2b-256 378a19a50417bc52ac98f4387d5810a5a9f2e3c43e7115e108a4b2c1bde56708

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