iitems

negmas.generics.iitems(x)

Enumerates a GenericMapping.

Parameters:

x (IterableMapping) – A generic mapping (see GenericMapping)

Examples

Example with a list

>>> for k, cutoff_utility in ienumerate([10, 20, 30]):
...     print(k, cutoff_utility, end="-")
0 10-1 20-2 30-

Example with a dictionary

>>> for k, cutoff_utility in ienumerate({"a": 10, "b": 20, "c": 30}):
...     print(k, cutoff_utility, end="-")
a 10-b 20-c 30-

Example with a tuple

>>> for k, cutoff_utility in ienumerate((10, 20, 30)):
...     print(k, cutoff_utility, end="-")
0 10-1 20-2 30-

Example with a generator

>>> for k, cutoff_utility in ienumerate(range(10, 40, 10)):
...     print(k, cutoff_utility, end="-")
0 10-1 20-2 30-
Return type:

Iterable[tuple[Any, Any]]

Returns:

a generator/iterator with tuples of key-value pairs.