Skip to main content

For all your adding needs, up to numbers of 250.

Project description


For all your adding needs, up to numbers of about 250 because otherwise the maximum recursion depth is exceeded.


The package can be installed using pip install pluspy.


To get the sum of two positive integers a and b, you would use plus(a, b):

>>> from plus import plus

>>> plus(2, 5)

Keep in mind the module is called plus, not pluspy.


What is plus?

Plus was made to redefine the '+'operator in a recursive way, without using the '+'-operator itself.


This library was inspired by the enormous amount of isEven and isOdd-type memes, including one where '+' was defined by hardcoding every possible combination of the first 100-or-so numbers.

It was not made with the intention of being used (obv.), but rather to see how ridiculous I could make this.

The last 5 lines (while-loop & bitshift) by themselves are actually enough to add two numbers together (and it doesn't exceed the maximum recursion depth instantly), which was also done for this very reason. That part being in there adds to the overall idea.

Why is there a cache?

Well you see, when using numbers above 10 it started to get a bit slow. Calculating plus(50, 20) had been running for half an hour, and wasn't showing any signs of stopping any time soon.

This meant I had to introduce dynamic programming to speed it up a bit, and store results of calculations that had been made before.

Project details

Download files

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

Files for pluspy, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pluspy-0.0.3.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View
Filename, size pluspy-0.0.3-py3-none-any.whl (3.8 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page