Carsten Haese wrote: > On Wed, 23 Nov 2005 23:39:22 +0100, Christoph Zwerschke wrote > > Carsten Haese schrieb: > > > > > Thus quoth the Zen of Python: > > > "Explicit is better than implicit." > > > "In the face of ambiguity, refuse the temptation to guess." > > > > > > With those in mind, since an odict behaves mostly like a dictionary, [] > > > should always refer to keys. An odict implementation that wants to allow > > > access by numeric index should provide explicitly named methods for that > > > purpose. > > > > Exactly. But I don't think in this case such methods would be > > needed. You easily get the i-th value in the ordered dict as > > d.values()[i]. > > > > -- Chris > > True enough, but unless the odict has its list of values on hand, you're > asking the odict to build a list of all its values just so that you can get > the i'th element. Having a method that does the equivalent of d[d.sequence[i]] > would be cleaner and more efficient. >
I'm going to add some of the sequence methods. I'm *not* going to allow indexing, but I will allow slicing. You can also do d[d.keys()[i]] This provides two ways of fetching values by index, so I don't want to add another. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > -Carsten -- http://mail.python.org/mailman/listinfo/python-list