Skip to main content

Decorator that adds math dunders to a class derived from a numeric type.

Project description

mathdunders provides a Python 3 decorator that automatically adds 23 math-related dunder methods to a class derived from a numeric type.

Installation:

pip install mathdunders

Usage:

from mathdunders import mathdunders

@mathdunders() class RealNumber(float): pass

x = RealNumber(1) + RealNumber(2) print(x, type(x)) # -> 3 <class 'main.RealNumber'>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mathdunders-0.2.4-py3-none-any.whl (2.2 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