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.0.dev3.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for fntypes-0.1.0.dev3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ee955e119c3932dbf86dbf4bb2a1fbafd833ce039d7ca05b7b1be6a13fc79fa |
|
MD5 | 910ea2f9194606cafa0c1d2addf3f62b |
|
BLAKE2b-256 | 3ee7bd40df7913b66cd8a61c1059311ce1312ca2a93f21aaa40ddb68d35b066a |