Persistent Collections

The persistent package provides two simple collections that are persistent and keep track of when they are mutated in place.

class persistent.mapping.PersistentMapping(**kwargs)[source]

Bases: UserDict.IterableUserDict, persistent.Persistent

A persistent wrapper for mapping objects.

This class allows wrapping of mapping objects so that object changes are registered. As a side effect, mapping objects may be subclassed.

A subclass of PersistentMapping or any code that adds new attributes should not create an attribute named _container. This is reserved for backwards compatibility reasons.

class persistent.list.PersistentList(initlist=None)[source]

Bases: UserList.UserList, persistent.Persistent

A persistent wrapper for list objects.

Mutating instances of this class will cause them to be marked as changed and automatically persisted.

append(item)[source]

S.append(object) – append object to the end of the sequence

extend(other)[source]

S.extend(iterable) – extend sequence by appending elements from the iterable

insert(i, item)[source]

S.insert(index, object) – insert object before index

pop([index]) → item -- remove and return item at index (default last).[source]

Raise IndexError if list is empty or index is out of range.

remove(item)[source]

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()[source]

S.reverse() – reverse IN PLACE