# pydicom.multival.MultiValue

class pydicom.multival.MultiValue(type_constructor: Callable[[_T], _ItemType], iterable: Iterable[_T], validation_mode: int = None)

  Class to hold any multi-valued DICOM value, or any list of items that are all of the same type.

  This class enforces that any items added to the list are of the correct type, by calling the constructor on any items that are added. Therefore, the constructor must behave nicely if passed an object that is already its type. The constructor should raise `TypeError` if the item cannot be converted.

  Note, however, that DS and IS types can be a blank string `''` rather than an instance of their classes.

  __init__(type_constructor: Callable[[_T], _ItemType], iterable: Iterable[_T], validation_mode: int = None) → None

    Create a new `MultiValue` from an iterable and ensure each item in the `MultiValue` has the same type.

    Parameters:

      - type_constructor (callable) – A constructor for the required type for all items. Could be the class, or a factory function. Takes a single parameter and returns the input as the desired type (or raises an appropriate exception).

      - iterable (iterable) – An iterable (e.g. `list`, `tuple`) of items to initialize the `MultiValue` list. Each item in the iterable is passed to type_constructor and the returned value added to the `MultiValue`.

  Methods

  `__init__`(type_constructor, iterable[, ...]) | Create a new `MultiValue` from an iterable and ensure each item in the `MultiValue` has the same type.
  `append`(val) | S.append(value) -- append value to the end of the sequence
  `clear`() |
  `count`(value) |
  `extend`(val) | Extend the `MultiValue` using an iterable of objects.
  `index`(value, [start, [stop]]) | Raises ValueError if the value is not present.
  `insert`(position, val) | S.insert(index, value) -- insert value before index
  `pop`([index]) | Raise IndexError if list is empty or index is out of range.
  `remove`(value) | S.remove(value) -- remove first occurrence of value.
  `reverse`() | S.reverse() -- reverse IN PLACE
  `sort`(*args, **kwargs) |

  append(val: _T) → None

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

  extend(val: Iterable[_T]) → None

    Extend the `MultiValue` using an iterable of objects.

  insert(position: int, val: _T) → None

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