Ray.Allen <ysj....@gmail.com> added the comment:

> > 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: http://codereview.appspot.com/4185044/

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9523>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to