On Jan 11, 5:53 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > What technique were you thinking of to look up the cached index values > in Python, just as a matter of curiosity? Storing them in a dict? It > would be hard to think of a faster way ... ;-)
I didn't have anything fancy in mind. I was just wondering whether it makes sense to replace a block of code like data = {'a' : 1, 'b' :2, 'c' : 3} for i in someLargeList: for name in ['a','b','c']: result.append(data[name]) with somthing like data = {'a' : 1, 'b' :2, 'c' : 3} dataValues = [data[k] for k in ['a','b','c'] for i in someLargeList: for index in [0,1,2]: result.append(dataValues[index]) It sounds like it's probably not worth the effort in general, but might be for extremely ultra-critical parts of code. Thanks -- http://mail.python.org/mailman/listinfo/python-list