Re: dbm/dictionary problem (bug?)

Tim Peters (tim@ksr.com)
Tue, 28 Jun 94 15:04:01 -0400

> I get an error when using the "items" or "values" method on a
> dictionary created via dbm. Is this a bug or did I do something wrong.

Not your fault -- from Python/dbmmodule.c:

static struct methodlist dbm_methods[] = {
{"keys", (method)dbm_keys},
{"has_key", (method)dbm_has_key},
{NULL, NULL} /* sentinel */
};

I.e., dbm dicts support only "keys" and "has_key" methods. Guess you
could extend the C implementation, or write Python functions to fake the
effect building on keys(), or the latter but disguise them as methods of
a dbm wrapper class written in Python.

health-and-industry-hand-in-hand-ly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp