Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

dict.values

Exposes a live view of dictionary values in key insertion order.

Version: Python 3.14; repository image, production runtime not attested

Syntax

m.values()

Exposes a live view of dictionary values in key insertion order.

Equal values are retained for distinct keys, and updates after view creation remain visible.

The view follows dictionary key insertion order and is evaluated against current bindings. Inserting b with value three after creating the view makes both threes visible; equal values belonging to different keys are not deduplicated.

d = {"a": 1}
v = d.values()
d["b"] = 1
assert list(v) == [1, 1]

Examples

m = {"a": 3}
view = m.values()
m["b"] = 3
print(list(view))

Result

[3, 3]

The view follows dictionary key insertion order and is evaluated against current bindings. Inserting b with value three after creating the view makes both threes visible; equal values belonging to different keys are not deduplicated.

Sources