curry.utility.binding module

class curry.utility.binding.Binding(mapping, key, value)[source]

Bases: object

commit()[source]
curry.utility.binding.binding(mapping, key, value)[source]

Context manager that temporarily binds a value in some mapping.

Parameters:
  • mapping – The mapping to modify.

  • key – The key indicating which item to modify.

  • value – The temporary value to use, or the special object del_.

Returns:

A context manager within which mapping[key] will be bound to value. If value is del_, then the element will be deleted. The original state will be restored when exiting the context.