Skip to main content

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


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.4.post3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

fntypes-0.1.4.post3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file fntypes-0.1.4.post3.tar.gz.

File metadata

  • Download URL: fntypes-0.1.4.post3.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.9 Darwin/23.6.0

File hashes

Hashes for fntypes-0.1.4.post3.tar.gz
Algorithm Hash digest
SHA256 da0b40925039ac98bff11b3f902cb1380c32671737ebc42014e26a327bd96811
MD5 270b3103f1964416705e88825e9c96dd
BLAKE2b-256 0cd020c11b86f20442e64d2dabb9342525a041561130e81ad71cfc309f1d155e

See more details on using hashes here.

File details

Details for the file fntypes-0.1.4.post3-py3-none-any.whl.

File metadata

  • Download URL: fntypes-0.1.4.post3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.9 Darwin/23.6.0

File hashes

Hashes for fntypes-0.1.4.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 ea67b65d1f528de742f91cea433aaccb6f6dabfbe8ea2c579878388e7c1b3b3e
MD5 541c289c8601726d55486c6d150b575b
BLAKE2b-256 ed372fb47ec4d531cfca52bf7b18379eee3c418d789b230b0cf182331a30b1c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page