Modifying Class Object

Duncan Booth duncan.booth at invalid.invalid
Mon Feb 8 12:57:45 EST 2010


T <misceverything at gmail.com> wrote:
> Duncan - Thanks for your help.  So each of the shelve entries I'm
> modifying look something like this:  myshelve[key]
> TestClassObject(param1, param2, param3, param4, param5, etc.).  In 
> this case, with quite a few parameters, would you suggest setting 
> writeback=True and just modifying the needed value, or rewriting the 
> entire entry?  I have to admit the writeback option looks good, and if
> the TestClassObject format ever changes (i.e. if I ever change the
> order of the params), this particular function will be unchanged.
> However, I don't know what the performance hit would be in using it.

Only you know your data and pattern of use. Try a few tests to get a feel 
of the trade-offs between explicitly flagging items as changed or using 
writeback=True.



More information about the Python-list mailing list