Author eric.araujo
Recipients Kain94, eric.araujo, georg.brandl, r.david.murray, rhettinger, stutzbach, terry.reedy, ysj.ray
Date 2011-02-10.22:09:48
SpamBayes Score 1.43136e-06
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?

> 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.  Do the views yield elements in the same order?  (In a dict, iteration order is undefined but consistent between the various views, IIUC.)

> 3. Remove dumb's keys() method which calls self._index.keys() since it is unnecessary.
Does dumb have no keys method then?

> 4. Using more specialized assertXxx methods in test cases.
See my comments on

> #5736 's patch for adding iteration to ndbm and gdbm modules simple
> calling PyObject_GetIter(dbm_keys(dbm, NULL)) for both gdbm and ndbm,
> but I feel it's better to create a seperate iterator object for gdbm objects.
Okay, so I shall close the other bug report, indicating it’s superseded by your patch.

I can’t judge the C code; maybe Raymond or Daniel will.  They’re also experts about collections and ABCs, so they’ll be able to confirm or infirm what I’ve said about dict views and the registration stuff (on codereview).
Date User Action Args
2011-02-10 22:09:49eric.araujosetrecipients: + eric.araujo, georg.brandl, rhettinger, terry.reedy, stutzbach, r.david.murray, Kain94, ysj.ray
2011-02-10 22:09:49eric.araujosetmessageid: <>
2011-02-10 22:09:48eric.araujolinkissue9523 messages
2011-02-10 22:09:48eric.araujocreate