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.post2.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file fntypes-0.1.2.post2.tar.gz
.
File metadata
- Download URL: fntypes-0.1.2.post2.tar.gz
- Upload date:
- Size: 5.3 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 | 27274d25d2fd3d8b4c1a35b2aa7033b552602fa96360b849acb468df08af439d |
|
MD5 | db23b099bc666ed0eed0c9ca643817ab |
|
BLAKE2b-256 | ba6bc8ad77968bd78d549cb59b9266a9355ef1a65d4d6c06c5fb22f4370bc3d1 |
File details
Details for the file fntypes-0.1.2.post2-py3-none-any.whl
.
File metadata
- Download URL: fntypes-0.1.2.post2-py3-none-any.whl
- Upload date:
- Size: 8.3 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 | 065c02bbb6b3bdfb64f635632de35a86659316eaf0276e78e39e55b5f92d7b27 |
|
MD5 | 33c7c7b45756d434e870cc363aa836c3 |
|
BLAKE2b-256 | a421aa4152a53a3399383e769539253c9b22acbb97fdb627321accabe9947aa1 |