add format index to support python2.6, #5101

Fix ipython1.2 for python2.6 (My first pull request, sorry if I fouled it up)