## Optimise Python with closures

This blog post by Dan Crosta is interesting. It talks about how is possible to optimise Python code for operations that get called multiple times avoiding the usage of Object Orientation and using Closures instead. While the “closures” gets the highlight, the main idea is a little more general. Avoid repeating code that is not necessary for the operation. The difference between the first proposed code, in OOP way and the last one The main differences are that both the config dictionary and the methods (which are also implemented as a dictionary) are not… Read More

## Narcissistic numbers

Here is a nice mathematical exercise from Programming Praxis. Is about finding the “narcissistic numbers”, n digit numbers numbers where the sum of all the nth power of their digits is equal to the number. To reduce the problem a little, I decided to start by limiting the number of digits. So, the first approach will be just calculate if a number is narcissistic of not. So, after checking it and making a couple of performance adjustments, the code is as follows…