No project description provided
Project description
fntypes
Functional typing in Python!
See examples
See documentation
fntypes is based on the belief that raising exceptions should be avoided. Therefore, it offers a set of functional types needed to write better code. This type strategy grants your project with higher control over type system - improves control flow
Contributions are welcome
@unwrapping
def send_funds(
sender_id: int,
receiver_id: int,
amount: decimal.Decimal,
) -> Result[TransactionID, str]:
sender = get_user(sender_id).expect("Sender is undefined")
receiver = get_user(receiver_id).expect("Receiver is undefined")
if sender.get_balance().unwrap() < amount:
return Error("Sender has not enough funds to complete transaction")
return Ok(
create_transaction(sender, receiver, amount)
.unwrap()
.transaction_id
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fntypes-0.1.1.tar.gz
(5.2 kB
view details)
Built Distribution
File details
Details for the file fntypes-0.1.1.tar.gz
.
File metadata
- Download URL: fntypes-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.11 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fca79128474deab13044279ce5aa33670a2f8c3ca3cc9d9164259f30e0ace48 |
|
MD5 | 855b6eb4cbc444bba17d1c2d27ba4d64 |
|
BLAKE2b-256 | 0ab0fa60ae709a0a1d725e46e01c35313da68562a6ade22cd9f8e67d6062fbf8 |
File details
Details for the file fntypes-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: fntypes-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.11 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45e7e6c1528d7e9ae7c7d0117acf8ac9cb1820056649ec2664489bd142ec6026 |
|
MD5 | 5cc194f102b9b35849522acb719b0644 |
|
BLAKE2b-256 | aa6e030bc96c3927d7b0c4fb0a520e51dbd34729d1520842967d32b0fbb5d070 |