Christoph Zwerschke wrote: > Fuzzyman schrieb: > > d.keys() will still return a copy of the list, so d.keys()[i] will > > still be slower than d.sequence[i] > > Right, I forgot that. Bengt suggested to implement __call__ as well as > __getitem__ and __setitem__ for keys, values and items. > > In this case, you could very effectively access it as d.values[i]. >
That means making keys, values, and items custom objects. Creating a new instance would have the overhead of creating 4 new objects instead of just 1. Is the added convenience worth it ? (Plus the extra layers of method calls for each access). I'm not sure. It's a nice idea in terms of using it (we could just leave the sequence attribute as an alias for the new keys attribute - for backwards compatibility). All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > -- Christoph -- http://mail.python.org/mailman/listinfo/python-list