### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# Module: `utils.contexts`

Context managers for temporarily updating dictionaries.

Authors:

- Bradley Froehle

## 1 Class

class `IPython.utils.contexts.``preserve_keys`(dictionary, *keys)

  Bases: `object`

  Preserve a set of keys in a dictionary.

  Upon entering the context manager the current values of the keys will be saved. Upon exiting, the dictionary will be updated to restore the original value of the preserved keys. Preserved keys which did not exist when entering the context manager will be deleted.

  `__init__`(dictionary, *keys)

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »