On Sat, Sep 15, 2012 at 4:43 AM, eryksun <eryk...@gmail.com> wrote: > else: > start = index(self.nCases + key if key < 0 else key) # may > raise TypeError > stop = start + 1 > step = 1
Gmail is such a pain sometimes. I should have called index first anyway: key = index(key) # may raise TypeError start = key + self.nCases if key < 0 else key stop = start + 1 step = 1 > records = [] > for i in range(start, stop, step): > ... > records.append(record) You can boost the performance here a bit by caching the append method. This avoids a LOAD_ATTR operation on each iteration: records = [] append = records.append for i in range(start, stop, step): ... append(record) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor