[Python-bugs-list] [ python-Feature Requests-520382 ] Update Shelve to be more dictionary like

noreply@sourceforge.net noreply@sourceforge.net
Wed, 13 Nov 2002 18:29:42 -0800


Feature Requests item #520382, was opened at 2002-02-20 03:39
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=520382&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Update Shelve to be more dictionary like

Initial Comment:
It's great to be able to add persistence by replacing 
a dictionary declaration with a shelf; however, it is 
not as substitutable as it could be.

Most importantly, we should add __iter__ so that
'for k in d' works for shelves as well as dictionaries.

Also 
add  .items .iteritems .iterkeys .itervalues .popitem .
setdefault .update and .values

These methods could be added to increase 
substitutability without affecting existing code.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-11-13 21:29

Message:
Logged In: YES 
user_id=80475

Here is a concept sketch patch for expanding the shelve 
interface.  The goal is to make it is easier to add 
persistence when an application was already developed 
using dictionaries as a base.

On a separate note, DictMixin is offered as a stand-alone 
class to make it easier to create classes with a full 
dictionary interface.  On py-dev, we concluded that 
DictMixin did not warrant its own module, so this would be 
a good place to expose the mixin class as an experimental 
feature while taking care of shelve at the same time.

If the concept sketch appeals to you, I'll add docs, 
unittests, and a news item.  DictMixin would be listed as 
experimental and potentially would not be visible in future 
versions of Python.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=520382&group_id=5470