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)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 517f8e48a486fa4b3aef65fe7fc756e7ebc5d89e825b890a9957aa21c38b7857 |
|
MD5 | 710f52190dfcf8edbcbd8dd477fffb66 |
|
BLAKE2b-256 | 55beecabc092c4e6aeea1fcdc9248b91dc2bcb72ccf7aa2ec97a1b459a041e62 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fb38e07bc2374d36330592e83ee9abc466dff4478aa3b549e52a5a55d1d9f00 |
|
MD5 | f830e89c6ef6becf5288a944554c8eaa |
|
BLAKE2b-256 | 22af5a4f823d687148fa95c3ed76bf740f9dc5040dd15634804ed9a7b88e0269 |