# 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`(dict=None, **kwargs)

  Bases: `collections.UserDict`, `persistent.persistence.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.

  `clear`() → None. Remove all items from D.
  `pop`(k[, d]) → v, remove specified key and return the corresponding value.

    If key is not found, d is returned if given, otherwise KeyError is raised.

  `popitem`() → (k, v), remove and return some (key, value) pair

    as a 2-tuple; but raise KeyError if D is empty.

  `setdefault`(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
  `update`([E, ]**F) → None. Update D from mapping/iterable E and F.

    If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

class `persistent.list.``PersistentList`(initlist=None)

  Bases: `collections.UserList`, `persistent.persistence.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)

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

  `extend`(other)

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

  `insert`(i, item)

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

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

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

  `remove`(item)

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

  `reverse`()

    S.reverse() – reverse IN PLACE