Skip to Content
Mastering Object-oriented Python
book

Mastering Object-oriented Python

by Steven F. Lott
April 2014
Beginner to intermediate
634 pages
15h 22m
English
Packt Publishing
Content preview from Mastering Object-oriented Python

The writeback alternative to index updates

We can request that a shelf be opened with writeback=True. This will track changes to mutable objects by keeping a cached version of each object. Rather than burdening the shelve module with tracking all accessed objects to detect and preserve changes, the designs shown here will update a mutable object and specifically force the shelf to update the persistent version of the object.

This is a small shift in the runtime performance. An add_post() operation, for example, becomes slightly more costly because it also involves updating a Blog entry. If multiple Posts are added, these additional Blog updates become a kind of an overhead. However, this cost may be balanced by the improved performance of rendering ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Object-Oriented Python - Second Edition

Mastering Object-Oriented Python - Second Edition

Steven F. Lott

Publisher Resources

ISBN: 9781783280971Supplemental Content