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.2.post1.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for fntypes-0.1.2.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e365c075b3b8c86615372125393750cd6bc165d72ec550b28ed64b01d7504597 |
|
MD5 | b7acff438ee19007786b3786a7104c33 |
|
BLAKE2b-256 | 825e946dd1879920d6502d5a60f3c4ef4110f7c9582fd61f6741f8f4fb3bbdd9 |