Well, actually I find the last code far better and easier than the original one. As I wrote in the article, if you want to add a factorial method you just need to change the catalog of the function provided by adding this line
“!”: lambda x: math.factorial(x),
However, it’s probably a matter of taste... but I do like the last code more. :)