About Me - The Short Story

I am a lonely Python/C++ coder with a background in financial markets and an interest in modern art. I am an application-driven guy, not a computer scientist. Sure I have many gaps in my knowledge, but I strive to do my best to fill them. I keep learning new things, listening to smart guys, correcting my mistakes, and pushing myself to the limits. I enjoy it.

I will use this website both as a blog and as a hub to some of my projects. It is written from scratch in Python's Flask, my favourite web-framework.


Find N largest or lowest values with heapq

You have a collection of items and you need to keep the N highest or lowest of them. Instead of writing your own algorithm, use build-in heapq module.

This module has two handy functions, nlargest(), and nsmallest().

This is...

python 
data-structures 
algorithms 


Tuple is not just an immutable list

All too often I see people referring to tuple as an immutable list. Also many tutorials on Python present tuples just as a list that cannot be changed. Although it is true that tuple is immutable, there is actually much more to...

python 
data-structures 
tuple 
list 


Caveat when removing elements from Python list or dict

There is a caveat when removing duplications from a list in Python using for loop. One thing you have to keep in mind to make it correct is, that you need to iterate over a copy of the list, not the list itself.

Suppose you have this...

python 
data-structures 
list 
dict