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.3.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file fntypes-0.1.3.tar.gz
.
File metadata
- Download URL: fntypes-0.1.3.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.9 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53ab258b256c237a7fbe2ad1222b775534bae3f72bd3d9639eb2fd6f02849753 |
|
MD5 | 6a8c91f26212b6277f585b1335426fb2 |
|
BLAKE2b-256 | 3544cb96853f0fa86c6e1990f53fdf58791e5f124b53538498f85f6c6ca17505 |
File details
Details for the file fntypes-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: fntypes-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.9 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58f0a9ffae535c463f4bc0d177705a094195fb7c5ada3e1eac1c144594751f34 |
|
MD5 | 03c46123f1130b2f5903a89261e743ad |
|
BLAKE2b-256 | 54c36307536f1c171694d9317ade15e0e1839b2f0c8246ce82293253d164a8fc |