A port of @sagivo's algorithms in Python 3
- Recursion over imperative looping constructs such as
for
/while
-loops (1) - Expressions over stateful methods and mutations (whenever possible)
Neither is easy to achive in OO, however, I believe mutability should be opt-in, not the other way around.
Notes:
- Recursion is not generally considered a good practice in Python. Python is not a functional programming language, and there is no TCO support in CPython after all. The focus here is, in fact, more on the algorithms despite being implemented in Python.
All tests can be found in tests.py. Run the following command to test them.
python -m tests
- Python 3.2
- Python 3.3
- Python 3.4
- More problems
- Further analysis/optimisation
Please feel free to submit an issue or pull request for any bugs you may find or algorithms incorrectly implemented.
GNU GPLv3