No project description provided
Project description
fntypes
Functional typing in Python!
See examples
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.dev1.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for fntypes-0.1.0.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4171b1836311953502d5094da1a11e7bed9a422ca4d05a2d360689eb28fe6e |
|
MD5 | 404440bed8fd934cb3dfc2f957b9d00c |
|
BLAKE2b-256 | 5ed0758a9b66fa59b18914f89878feb1e04efc7e44a9eb2511f99ce9aceb57e5 |