bsddb185 question

"Martin v. Löwis" martin at v.loewis.de
Wed Nov 23 05:36:25 EST 2005


thakadu wrote:
> However the line:
> del db[key]
> results in an error: (1, 'Operation not permitted')
> (only tested on Python 2.3.5)

Did you open the dbm file for read-write? This should work,
and is implemented.

> Could this be because the .del() method of the dictionary
> has not been implemented either? In fact in my tests
> any attempt at altering the db by use of normal dictionary
> methods fails with the same error. e.g.
> db['newkey']='newvalue' causes the same error.

Ah, so you definitely should pass the "w" argument to the
open function.

> Thanks for your info on the rules for interface implementation
> in Python. That is an interesting difference. I have grown to
> like the rules for java interface implementation because you
> are guaranteed that all defined methods for the interface have
> been implemented. That is what is meant by "implementing" an
> interface in java.

In Python, there is also the notion of implementing an interface.
However, the interface is just specified in English text,
and the interpreter never checks whether all of them are
implemented. For mapping types,

http://www.python.org/doc/current/lib/typesmapping.html

gives the list of operations they ought to support.

Regards,
Martin



More information about the Python-list mailing list