survey: is shelve broken? should it be fixed?

holger krekel pyth at devel.trillke.net
Tue May 7 13:51:19 EDT 2002


Martin v. L?wis wrote:
> Oleg Broytmann <phd at phd.pp.ru> writes:
> 
> > On Tue, May 07, 2002 at 02:34:53PM +0200, Martin v. L?wis wrote:
> > > I wouldn't call the feature 'smart'
> > 
> >    modify-in-place?
> 
> Something like that: no-copy-mutables, or some such.
> 
> Of course, this can't work in the general case: If somebody puts a
> class instance into the shelve, you cannot expect that all
> modifications to the instance are reflected in the shelve.
> 
> So it might be something like
> 
>   transparent_modification=(list, dict)

i'd suggest something like

    shelve.returncopies=0

on a global module level. Every time we are 
fixing "python semantics" rather than introducing new 
features we should do it on the module level.

These keyword-arguments like 'smart' are code-bloat
and scattered all over the code. Having a section
on top of a python script basically like

assert(pythonversion >2.2.4)
if pythonversion < 2.3.0:
    shelve.returncopies=0
    somemodule.somefeature=1

is just much nicer and encapsulated.

    holger





More information about the Python-list mailing list