list()

list([iterable])
Returns: list · Updated March 13, 2026 · Built-in Functions
built-in list constructor conversion sequence

The list() constructor creates a list object. When called without arguments, it returns an empty list. When called with an iterable argument, it creates a new list containing all items from that iterable. This makes list() essential for converting other sequences or iterables into lists.

Syntax

list()
list(iterable)

Parameters

ParameterTypeDefaultDescription
iterableiterableAny iterable (string, tuple, set, dict, range, iterator, etc.). If omitted, returns an empty list.

Examples

Creating an empty list

empty = list()
print(empty)
# []

Converting a string to a list

Strings are iterables of characters:

text = "hello"
chars = list(text)
print(chars)
# ['h', 'e', 'l', 'l', 'o']

Converting a tuple to a list

coordinates = (10, 20, 30)
coord_list = list(coordinates)
print(coord_list)
# [10, 20, 30]

Converting a set to a list

Sets are unordered, so the order may vary:

unique_ids = {101, 102, 103}
id_list = list(unique_ids)
print(id_list)
# [101, 102, 103]  # order may differ

Converting a dictionary to a list

Only the keys are included:

scores = {"Alice": 95, "Bob": 87}
keys = list(scores)
print(keys)
# ['Alice', 'Bob']

Using with generators and iterators

def squares(n):
    for i in range(n):
        yield i ** 2

# Convert generator to list
squares_list = list(squares(5))
print(squares_list)
# [0, 1, 4, 9, 16]

Using with range()

numbers = list(range(1, 11))
print(numbers)
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

When to Use list() vs [] vs List Comprehension

ScenarioUseWhy
Empty list[] or list()Both work, but [] is more idiomatic and faster
Convert iterablelist(iterable)Required to create list from tuple, set, generator, etc.
Create list with known values[] with elements[1, 2, 3] is clearer than list([1, 2, 3])
Transform and filterList comprehension[x*2 for x in items if x > 0] is more readable

Examples comparing approaches

# Empty list — prefer []
empty1 = []
empty2 = list()

# Convert tuple to list — must use list()
my_tuple = (1, 2, 3)
converted = list(my_tuple)

# Create list with values — prefer []
with_values = [1, 2, 3]

# Transform items — prefer comprehension
items = [1, 2, 3, 4, 5]
doubled = [x * 2 for x in items]

Common Mistakes

Forgetting that list() only extracts dict keys

d = {"a": 1, "b": 2}

# Common mistake: expecting key-value pairs
wrong = list(d)
print(wrong)  # ['a', 'b'] — just keys!

# Correct: use items() for pairs
correct = list(d.items())
print(correct)  # [('a', 1), ('b', 2)]

Using list() when a generator is more appropriate

For large datasets, creating a list eagerly consumes memory:

# BAD: loads all million items into memory
million_list = list(large_generator())

# GOOD: lazy evaluation
for item in large_generator():
    process(item)

Confusing list() with list.copy()

original = [1, 2, 3]

# Creates a new list by copying — same as list() on a list
shallow_copy = list(original)

# Equivalent to above
shallow_copy2 = original.copy()

See Also