CKTIS / Python
list()
Materializes the items of an iterable into a new mutable list.
Version: Python 3.14; repository image, production runtime not attested
Syntax
list(iterable=(), /)Materializes the items of an iterable into a new mutable list.
Creating a list from an iterator consumes it. A second conversion sees only the remaining items.
The constructor reads an iterable in order into a new mutable list. For a one-shot iterator, the first call consumes 3 and 5; the second sees exhaustion and yields an empty list. Construction is shallow and keeps references to the original elements. No argument gives an empty list.
v = [[]]
a = list(v)
assert a is not v and a[0] is v[0]
it = iter([3, 5])
assert list(it) == [3, 5] and list(it) == []
Examples
items = iter((3, 5))
print(list(items))
print(list(items))
Result
[3, 5] []
The constructor reads an iterable in order into a new mutable list. For a one-shot iterator, the first call consumes 3 and 5; the second sees exhaustion and yields an empty list. Construction is shallow and keeps references to the original elements. No argument gives an empty list.