ikeys

negmas.generics.ikeys(x)[source]

Returns all keys of the iterable.

Parameters:

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

Examples

Example with a list

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

Example with a dictionary

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

Example with a tuple

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

Example with a generator

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

Iterable[Any]

Returns:

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