Skip to main content

A collection of some helper functions

Project description

python-trick

一些helper函数合集。

Reference

compose

def add_ten(x: int) -> int:
    return x + 10

def multi_five(x: int) -> int:
    return x * 5

add_ten_then_multi_five = compose(multi_five, add_ten)

add_ten_then_multi_five(2)  # output: 60

curry

@curry
def add(a, b, c, d):
    return a + b + c + d

assert add(1, 2, 3, 4) == add(1)(2)(3)(4)

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

trick-0.1.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

trick-0.1.0-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

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