The ultimate guide to Python decorators

Decorators are one of the most beautiful feature of Python programming language. They can make code easy-readable and maintainable. Nevertheless, their usage may seem tricky and mysterious in the beginning. This is a guide to the world of decorators. I hope that you will feel like a pro and have no questions left about them after exploring this article.

Read more...

A micro Lisp interpreter experiment

While reading the Binary trees chapter from Programming Interviews Exposed by John Mongan et al. I started thinking of alternative recursion examples which do not involve sorting, generating Fibonacci sequence, binary tree traversal and similar tasks. Lisp! Lisp is inseparable from recursion and Lisp interpreter would be a good case to demonstrate what recursion is and how it can be used efficiently. What would be a minimal simplified Lisp interpreter written in Python? Surprisingly, I managed to do it just in 6 lines of Python code! And this is not just because of Python being a wonderful language, but because of Lisp being such a beautiful and simple concept.

Read more...

ECCO online

Ah, magnificent Finnish winter! First, it was jumping around zero (Celsius of course), so that people had to deal with slippery roads and pavement, then it dropped to -25, so that people put on layers of clothes. Then a snowstorm hit Finland, and it was above -10 again, with mountains of snow. There is an important part of the wardrobe that helps dealing with all these weather conditions: the shoes.

Read more...

Microsoft Wireless Mouse 5000: The Good, the Bad and the Ugly.

I have finally replaced my old Defender mouse with a brand-new, wireless blue laser-powered Microsoft Wireless Mouse 5000. Some of the reasons for picking this particular mouse are: symmetric, wireless, laser and GNU/Linux support :). A month of usage has passed and there is enough time to write a review with all tips'n'tricks which can help handling this mouse properly.

Read more...

PyRegs: The Python Regex Debugger

Long ago, I learned the regular expressions in order to write a simple syntax highlighting engine. Regular expressions are not hard to master, but take time to practice. Kodos was the regex debugger of my choice, as it was written in Python. All these years Kodos was a "must have" tool on my development machines. Suddenly with the new version of Debian operating system, Kodos was not in the repositories anymore! Why? Kodos is based on QT3 widgets toolkit, which is a bit outdated nowadays (QT5 has been released recently) and was removed from Debian 7.0 ("Wheezy"). That is how I decided to write a small Python regex debugger in Python 3 and its de-facto standard Tkinter bindings to the Tk GUI toolkit.

Read more...