[Python-Dev] Python 3.0: can we make dbm's .keys() return an iterator?
Gerhard Häring
gh at ghaering.de
Thu Sep 11 11:40:59 CEST 2008
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.
-- Gerhard
More information about the Python-Dev
mailing list