For all your adding needs, up to numbers of 250.
For all your adding needs, up to numbers of about 250 because otherwise the maximum recursion depth is exceeded.
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
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 (
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.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pluspy-0.0.2.tar.gz (2.5 kB)||File type Source||Python version None||Upload date||Hashes View|
|Filename, size pluspy-0.0.2-py3-none-any.whl (3.6 kB)||File type Wheel||Python version py3||Upload date||Hashes View|