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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythonz-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 517f8e48a486fa4b3aef65fe7fc756e7ebc5d89e825b890a9957aa21c38b7857
MD5 710f52190dfcf8edbcbd8dd477fffb66
BLAKE2b-256 55beecabc092c4e6aeea1fcdc9248b91dc2bcb72ccf7aa2ec97a1b459a041e62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythonz-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fb38e07bc2374d36330592e83ee9abc466dff4478aa3b549e52a5a55d1d9f00
MD5 f830e89c6ef6becf5288a944554c8eaa
BLAKE2b-256 22af5a4f823d687148fa95c3ed76bf740f9dc5040dd15634804ed9a7b88e0269

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