class type_param_demo.Map[KV][source]

Maps keys of type K to values of type V.

Type Parameters:
K

Key type.

V

Mapped value type.

Constructors

Map()[source]
Map(items: Mapping[K, V])
Map(items: Iterable[tuple[K, V]])

Construct from the specified items.

Public members

clear()[source]

Clear the map.

keys(-> KeysView[K][source]

Return a dynamic view of the keys.

items(-> ItemsView[K, V][source]

Return a dynamic view of the items.

values(-> ValuesView[V][source]

Return a dynamic view of the values.

get(key: K-> V | None[source]
get(key: Kdefault: V-> V
get[T](key: Kdefault: T-> V | T

Return the mapped value, or the specified default.

__len__(-> int[source]

Return the number of items in the map.

__contains__(key: K-> bool[source]

Check if the map contains key.

__getitem__(key: K-> V[source]

Return the value associated with key.

__setitem__(key: Kvalue: V)[source]

Set the value associated with the specified key.

__delitem__(key: K)[source]

Remove the value associated with the specified key.

__iter__(-> Iterator[K][source]

Iterate over the keys.


Last update: Nov 16, 2024