Saturday, July 08, 2006

Python note: __hash__

__hash__ provides the hash code for an object. It is used under two circumstances: when the object is put in a dictionary; or when hash() built-in function is called.

There is a requirement for this method - two objects should have the same hash when their __cmp__ returns zero (they are equal). Thus when a class does not provide __cmp__ member function, it should not provide __hash__.

Friday, July 07, 2006

VIM note: tabs

In VIM 7, tab view is supported.

To open a new tab, use :tabnew
To navigate among tabs, use 'gt'
To close a tab, use ':tabclose'