On Thu, Feb 13, 2014 at 3:01 PM, Neil Cerutti <ne...@norwich.edu> wrote: > On 2014-02-13, Zachary Ware <zachary.ware+pyl...@gmail.com> wrote: >> C:\tmp>py -m timeit -s "key = ''" "key[0] == '<' and key[-1] == '>'" >> Traceback (most recent call last): >> File "P:\Python34\lib\timeit.py", line 292, in main >> x = t.timeit(number) >> File "P:\Python34\lib\timeit.py", line 178, in timeit >> timing = self.inner(it, self.timer) >> File "<timeit-src>", line 6, in inner >> key[0] == '<' and key[-1] == '>' >> IndexError: string index out of range > > The corrected version > > key and key[0] == '<' and key[-1] == '>' > > probably still wins the Pretty Unimportant Olympics.
Indeed, see the last set of timings and moral ;) -- Zach -- https://mail.python.org/mailman/listinfo/python-list