Skip to main content

Autopartial

This is a simple library that provides a decorator that allows your to apply a function partially. In other words, it allows you to curry a function with some of its arguments, from left to right.

Installation

After cloning this repository, you can install the package by running the following command in the root directory of the repository:

pip install -e .

Usage and example

The main use case is to decorate a function definition with @autopartial.

An example can is in main.py. It contains the following code:

from autopartial import autopartial

@autopartial
def add(x, y):
	return x + y

if __name__ == '__main__':
	x = 10
	y = 20

	add_10 = add(x)	 # add(x): y -> x + y
	print(add_10(y)) # 30

Here, the add function takes 2 arguments and returns its sum. You can now partially apply the argument x to add by calling add(x). This returns a new function that takes only one argument y and returns x + y.

In the example above, add(10) returns a function add_10 that always adds 10 to its input.

You can run this example, after installing this package, by running the following command from the root of the repository:

python main.py

Metadata

Release files for autopartial 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for autopartial 0.0.1
File Interpreter ABI Platform
autopartial-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / autopartial-0.0.1-py3-none-any.whl

Download URL autopartial-0.0.1-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d6e305de0f6e10a521c64ac38499d6a2a4053b2383f34e09871c31dfc2a1331
BLAKE2b-256 checksum
How to use checksums
1ee8a8af3dc87e6dad85ae17ca7d81f5529681ae44de09e5e734c51717f85af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for autopartial 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page