Author ysj.ray
Recipients Kain94, eric.araujo, georg.brandl, r.david.murray, rhettinger, stutzbach, terry.reedy, ysj.ray
Date 2011-02-12.16:49:27
SpamBayes Score 5.1427e-05
Marked as misclassified No
Message-id <>
> > 1. Make keys(), values(), items() methods return view object for ndbm, gdbm and dumb objects. I following the codes in dictobject.c.
> Did you have to copy the code?  Isn’t it possible to somehow reuse it?

I feel not so easy to reuse the code, there could be several differences in the c code. Resuing the code may make the code more complecated. But if someone could find a better way to reuse the code, it would be nice.

> > The keysview object support len(), "in" operator, and iteratable, while valuesview and itemsview object only support len() and iteratable.
> That does not seem to comply with the definition of dict views. 

Oh, yes, I missed the rich compare functions and isdisjoint() method of view objects.

> Do the views yield elements in the same order?  (In a dict, iteration order is undefined but consistent between the various views, IIUC.)
gdbm and dumb views yield elements in the same order, ndbm views doesn't. I missed it.

> > 3. Remove dumb's keys() method which calls self._index.keys() since it is unnecessary.
> Does dumb have no keys method then?
Yes, it does. Its keys() method is provided by Mapping abc already.

Here is the updated patch:
1. Add rich compare functions and disjoint() method to dbm view objects to make them as MappingView objects, and add abc registration for them.
2. Make ndbm view objects yield elements in the same order.
3. Other changes during to the codeview:
Date User Action Args
2011-02-12 16:49:28ysj.raysetrecipients: + ysj.ray, georg.brandl, rhettinger, terry.reedy, stutzbach, eric.araujo, r.david.murray, Kain94
2011-02-12 16:49:28ysj.raysetmessageid: <>
2011-02-12 16:49:28ysj.raylinkissue9523 messages
2011-02-12 16:49:27ysj.raycreate