Reinhold Birkenfeld wrote: > Other possibility, probably faster when almost all keys in the range are in > the dictionary: > > class sdict(dict): > def __getitem__(self, index): > if isinstance(index, slice): > d = {} > for key in xrange(slice.start, slice.stop, slice.step):
Hm. I wonder whether (x)range could be made accepting a slice as single argument... Reinhold -- http://mail.python.org/mailman/listinfo/python-list