Saturday, January 30, 2016

Fast Object-Oriented Heap Implementation

There comes light to the darkness of your heaps.

This is the third post of a series of heap-related ones. See here and here for the back story.

In the last post, we found the heapq module lacking important features. Average Joe Dev doesn't want to clutter up his source code and and re-implement the same features all over the place to rectify the shortcomings of heapq. Understandably, Python core devs don't want to compromise on the performance of heapq either—being fast is the mission of a heap.

Tuesday, January 26, 2016

heapq and Missing Features

You sometimes need a bit more convenience than a barrel to store your water.

Recently, I wrote about heaps in Python and promised a sequel. Here, you are. This time, we ponder over the shortcomings of Python's heap module, heapq.

So, what's wrong with it? Nothing at all if you have the basic needs: fast push and pop onto a heap. However, as usual, at a certain point, you want more features in your program which in turn set the requirements higher for the heap implementation you use. If that happens, you usually

Heaps in Python

This time, we dig into the matter of how we can use heaps in Python. As a starter, you want heaps when there's a job to do like the following:

queue=[]
while necessary:
    ...
    queue.append(an_item)   # or two
    ...
    ...
    next_item = min(heap)   # what's next
    ...
    queue.remove(next_item) # we're done; remove it
    ...

Thursday, January 7, 2016

PostgreSQL 9.5 released

Congratulation to the PostgreSQL Global Development Group for finishing another release of a great piece of software. There is pretty massive set of release notes online of which I'd like to cover the most notably changes and additions.

Tuesday, January 5, 2016

Boon and Bane of IDEs

I have come to know many different people and engineers in the recent years. Many of them use IDEs for the day-to-day work. So far, so good. Though, I noticed some of them are not able to help themselves our of weird situations where an IDE corrupted some project config files or generated other strange output. Some of them don't even know how to use subversion or git without a GUI.