On Thu, Sep 11, 2008 at 2:40 AM, Gerhard Häring <[EMAIL PROTECTED]> wrote: > As far as I can see, the specification of the dbm interface is the module > docstring in dbm/__init__.py, which reads: > > """ > [...] > It has the following interface (key and data are strings): > > d[key] = data # store data at key (may override data at > # existing key) > data = d[key] # retrieve data at key (raise KeyError if no > # such key) > del d[key] # delete data stored at key (raises KeyError > # if no such key) > flag = key in d # true if the key exists > list = d.keys() # return a list of all existing keys (slow!) > """ > > Now I thought that in Python 3.0, keys(), values() and friends should return > iterators. Can we change at least the specification of the dbm module? We > could then later in 3.1 change the implementations to return iterators > instead of lists, too. > > I stumbled upon it cos I'm trying to help Skip with the SQLite-based > implementation.
If it's to be following a variant of the dictionary API, the object should return a view object: http://docs.python.org/dev/3.0/library/stdtypes.html#dict . I've updated my version of the library in the tracker, which includes generic Keys, Values, and Items classes that implement the view interface. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com