Skip to main content

No project description provided

Project description

funcclasses

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install funcclasses

Usage

partial

from typing import Callable, SupportsInt, SupportsComplex, SupportsFloat
from beartype import beartype
from funcclasses.partial import partial

Numberlike = SupportsFloat | SupportsComplex | SupportsInt

def my_list_mut(
        func: Callable[[Numberlike, Numberlike], Numberlike],
        a: Numberlike,
        b: Numberlike,
    ):
    return func(a,b)

@beartype
def add(a:Numberlike, b:Numberlike) -> Numberlike:
    return a + b

sum_generic = partial(my_list_mut, add)

if __name__ == "__main__":
    sum_generic(a=21,b=21) # -> 42

License

funcclasses is distributed under the terms of the MIT license.

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

funcclasses-0.0.2.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

funcclasses-0.0.2-py3-none-any.whl (3.7 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