Skip to main content

No project description provided

Project description

fntypes

Functional typing in Python!

See examples

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.0.dev2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

fntypes-0.1.0.dev2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file fntypes-0.1.0.dev2.tar.gz.

File metadata

  • Download URL: fntypes-0.1.0.dev2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.11 Darwin/23.1.0

File hashes

Hashes for fntypes-0.1.0.dev2.tar.gz
Algorithm Hash digest
SHA256 581f470062ace7f3035eb80ff684d2bc47a796c416254721876366b5f5ceec4d
MD5 641696b66184248d8b60fcf9e77eef2e
BLAKE2b-256 57c4fa92bf0c8a7ee89b2d119c59de2e535068128a296809b3303af620861fab

See more details on using hashes here.

File details

Details for the file fntypes-0.1.0.dev2-py3-none-any.whl.

File metadata

  • Download URL: fntypes-0.1.0.dev2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.11 Darwin/23.1.0

File hashes

Hashes for fntypes-0.1.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 e85f9d947132d5a8706b7d17dae48880b97c76330fcfdc074a75a898d13fa54f
MD5 72cc607c118e5da910fd5919e5ca4ece
BLAKE2b-256 aff1147582830d68e882809f169382788e62c93695f51398f03b0f967f940e9e

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