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

Uploaded Source

Built Distribution

fntypes-0.1.4.post2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fntypes-0.1.4.post2.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.post2.tar.gz
Algorithm Hash digest
SHA256 2912a82853bbb21ae5db2d6de363f859b6e4eb5373787873ef3ddeae08e2a6ef
MD5 23a196e0b1a7169fbb5e677d51ffdadc
BLAKE2b-256 b76af8c673685dc86c576cbccf2e4550af30175cbbfb5371791607662a9bdeff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fntypes-0.1.4.post2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 eca098a93c0b75f2bd42cd09dd63e98c92f55d3cb3f4d0d701932880f629544e
MD5 a44876ac0a94a077958a8b7052c60535
BLAKE2b-256 55521ffbf596f2470beb04c24579942d3f03f3525e861a005c3654bf42cf0815

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