No project description provided
Project description
funcclasses
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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for funcclasses-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 916b25c3f2deb0e9790f092d8ef6835a6b3a8b4a905e717adfc3b8dd2e7a6f29 |
|
MD5 | 57b4d4d1f690cb272ce3395f84326bb6 |
|
BLAKE2b-256 | aa72d2d806657aee8662ead6e8301dcdb301625070e3745652f8779ab4dbdd19 |