There's a huge difference.

  1. Sets can't contain duplicates
  2. Sets are unordered
  3. In order to find an element in a set, a hash lookup is used (which is why sets are unordered). This makes __contains__ (in operator) a lot more efficient for sets than lists.
  4. Sets can only contain hashable items (see #3). If you try: set(([1],[2])) you'll get a TypeError.

In practical applications, lists are very nice to sort and have order while sets are nice to use when you don't want duplicates and don't care about order.

Also note that if you don't care about order, etc, you can use

new_set = myset.intersection(mylist)

to get the intersection between a set and a list.

Answer from mgilson on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › sets-vs-lists-python
Sets vs. Lists - Python - GeeksforGeeks
July 23, 2025 - The main difference is that lists are ordered, meaning the order of elements is preserved and they can be accessed by their index while sets are unordered meaning they do not maintain the order of elements and automatically ensure all elements are unique. This article will explore the differences between ...
Discussions

Python Sets vs Lists - Stack Overflow
Sets are also sequence structures ... from lists and tuples. Although sets do have an order, that order is arbitrary and not under the programmer’s control. The second difference is that the elements in a set must be unique. ... First off, you should update to the set built-in type link (docs.python.org/2/lib... More on stackoverflow.com
🌐 stackoverflow.com
What makes lists different than sets?
Lists are ordered and can contain duplicate items. Sets are unordered and all items must be unique. More on reddit.com
🌐 r/learnpython
10
1
July 24, 2018
What is difference between list and set in python? - Stack Overflow
I read that list takes O(n) for searching where as set takes O(1). 1)I don't understand why searching takes different time even though they are containing multiple elements. 2)why using set rather ... More on stackoverflow.com
🌐 stackoverflow.com
Differences in terms of performance between list, set, and numpy arrays?
Accessing a single element in a list is 5x faster than accessing a single element in a numpy array, 22.1 ns rather than 123 ns on my pc. Lists are better for single-element operations. A one-million-element multiplication operation on a numpy array is 50x faster than the similar list-comprehension operation, 1.28 ms rather than 64.2 ms. Numpy arrays are better for array operations. (These figures are copied from a test I did about 5 years ago, i.e. before the Faster CPython project, but should still be mostly relevant. The ipython %%timeit has its setup on the first line and times the second line.) In [2]: %%timeit mylist = [1,2,3] ...: x = mylist[1] ...: 22.1 ns ± 0.0626 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each) In [3]: %%timeit import numpy; myarray = numpy.array([1,2,3]) ...: x = myarray[1] ...: 123 ns ± 0.0508 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each) In [4]: %%timeit mylist = list(range(1000000)) ...: newlist = list(n*2 for n in mylist) ...: 64.2 ms ± 704 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) In [5]: %%timeit import numpy; myarray = numpy.arange(1000000) ...: newarray = myarray * 2 ...: 1.28 ms ± 1.43 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each) More on reddit.com
🌐 r/learnpython
6
6
May 12, 2024
🌐
freeCodeCamp
freecodecamp.org › news › python-set-vs-list
Python Set VS List – Sets and Lists in Python
January 5, 2023 - Sets and lists are built-in data structures you can use to store and arrange values in Python. If you're wondering which to use, it depends on the use case. If you don’t want the values in the data to change, you can use a set. But if you want the items to change, you can use a list. You can also take into account whether the order of the items matters to you or not. That's why this article took you through what set and list are, how to create them, and most importantly the differences between the two of them.
🌐
Medium
medium.com › @garybao › python-set-vs-list-whats-the-difference-and-when-to-use-each-05f2541144db
Python set vs list: What’s the Difference and When to Use Each | by Gary Bao | Medium
June 20, 2025 - ... fruits = ['apple', 'banana', 'apple', 'orange'] print(fruits) # Output: ['apple', 'banana', 'apple', 'orange'] ... A set is an unordered collection that automatically removes duplicates and only keeps unique items.
🌐
DataCamp
datacamp.com › tutorial › sets-in-python
Python Sets Tutorial: Set Operations & Sets vs Lists | DataCamp
December 13, 2022 - Lists and tuples are standard Python data types that store values in a sequence. Sets are another standard Python data type that also store values. The major difference is that sets, unlike lists or tuples, cannot have multiple occurrences of the same element and store unordered values.
🌐
GeeksforGeeks
geeksforgeeks.org › python › difference-between-list-vs-set-vs-tuple-in-python
Difference between List VS Set VS Tuple in Python - GeeksforGeeks
July 15, 2025 - ... # Creating a List a = [1, 2, ... # Removing an element a.remove(3) # List slicing print(a[1:3]) ... A Set is an unordered collection of unique elements....
Top answer
1 of 11
316

It depends on what you are intending to do with it.

Sets are significantly faster when it comes to determining if an object is present in the set (as in x in s), but its elements are not ordered so you cannot access items by index as you would in a list. Sets are also somewhat slower to iterate over in practice.

You can use the timeit module to see which is faster for your situation.

2 of 11
243

Lists are slightly faster than sets when you just want to iterate over the values.

Sets, however, are significantly faster than lists if you want to check if an item is contained within it. They can only contain unique items though.

It turns out tuples perform in almost exactly the same way as lists, except for their immutability.

Iterating

>>> def iter_test(iterable):
...     for i in iterable:
...         pass
...
>>> from timeit import timeit
>>> timeit(
...     "iter_test(iterable)",
...     setup="from __main__ import iter_test; iterable = set(range(10000))",
...     number=100000)
12.666952133178711
>>> timeit(
...     "iter_test(iterable)",
...     setup="from __main__ import iter_test; iterable = list(range(10000))",
...     number=100000)
9.917098999023438
>>> timeit(
...     "iter_test(iterable)",
...     setup="from __main__ import iter_test; iterable = tuple(range(10000))",
...     number=100000)
9.865639209747314

Determine if an object is present

>>> def in_test(iterable):
...     for i in range(1000):
...         if i in iterable:
...             pass
...
>>> from timeit import timeit
>>> timeit(
...     "in_test(iterable)",
...     setup="from __main__ import in_test; iterable = set(range(1000))",
...     number=10000)
0.5591847896575928
>>> timeit(
...     "in_test(iterable)",
...     setup="from __main__ import in_test; iterable = list(range(1000))",
...     number=10000)
50.18339991569519
>>> timeit(
...     "in_test(iterable)",
...     setup="from __main__ import in_test; iterable = tuple(range(1000))",
...     number=10000)
51.597304821014404
Find elsewhere
🌐
Towards Data Science
towardsdatascience.com › home › data science › python lists vs sets
Python Lists vs Sets | Towards Data Science
December 19, 2020 - You have now learned some critical differences between lists and sets. These are the key takeaways: Lists can contain all sorts of data types (be careful with this) ... Sets cannot contain duplicates, and they will simply disappear.
🌐
Quora
quora.com › What-is-the-key-difference-between-a-set-and-a-list-in-Python
What is the key difference between a set and a list in Python? - Quora
Answer (1 of 2): Sets and Lists are both standard datatypes in python that are used to store values in a sequence. 1. The major and most important difference between sets and list is that unlike lists, Sets cannot store multiple occurrences of the same elements. All elements are unique in a set....
🌐
Javatpoint
javatpoint.com › set-vs-list-in-python
Set vs List in Python
Difference between Set and List in Python with python, tutorial, tkinter, button, overview, entry, checkbutton, canvas, frame, environment set-up, first python program, operators, etc.
🌐
PythonForBeginners.com
pythonforbeginners.com › home › list vs set in python
List vs Set in Python - PythonForBeginners.com
May 15, 2023 - You can add and delete elements from a set as well as a list. However, you cannot add mutable objects like lists, sets, dictionaries, etc to a set. Sets can only contain immutable elements. We can use the in operator to check if an element is present in a set as well as a list. There is no difference between using the in operator with a list or set.
🌐
Quora
quora.com › What-are-the-differences-between-lists-and-sets-in-Python-and-when-do-I-use-one-over-the-other
What are the differences between lists and sets in Python and when do I use one over the other? - Quora
Answer (1 of 2): Lists and sets are very different from each other. * Lists can contain any data item you want, including other lists or dictionaries: sets can only contain immutable data (integers, floats, strings, tuples) - if you can use it as a key in a dictionary yoh can store it in a set....
🌐
Medium
medium.com › @rstaze1 › why-using-sets-instead-of-lists-in-python-can-save-time-and-money-eb60581b803f
Why Using Sets Instead of Lists in Python Can Save Time and Money | by Rstaze Engineering | Medium
December 25, 2024 - While lists are versatile and allow duplicate values, sets are unique in that they store only distinct elements and offer exceptional speed for certain operations, such as membership testing.
🌐
Towards Data Science
towardsdatascience.com › home › artificial intelligence › 15 examples to master python lists vs sets vs tuples
15 Examples to Master Python Lists vs Sets vs Tuples | Towards Data Science
December 1, 2020 - The count function can be used to count the number of occurrences of a specific element. It is only used with lists and tuples. Since sets do not contain any duplicate items, the count is 1 for all items. ... We have covered the differences and similarities between 3 essential data structures in Python.
🌐
Medium
prajeetkalchuri18.medium.com › sets-vs-lists-python-53e08a9b0076
Sets vs. Lists | Python. What Makes Sets Faster Than Lists? | by Prajeet Singh Kalchuri | Medium
July 26, 2021 - You have to keep one most important thing in your mind : that sets aren’t faster than lists in general — membership test is faster for sets, and so is removing an element , and As long as you don’t need these operations, lists are often faster.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-what-makes-sets-faster-than-lists
Python - What Makes Sets Faster Than Lists ? - GeeksforGeeks
July 23, 2025 - In the worst case, you need to check every single element, which results in a time complexity of O(n). Set: In contrast, sets use a hash table to store elements. When you perform a membership test (x in set), Python directly calculates the hash ...
🌐
Towards Data Science
towardsdatascience.com › home › programming › 3 reasons to use sets over lists
3 Reasons to Use Sets over Lists | Towards Data Science
June 16, 2022 - Storing the outputs of the list case in a list would take more time and introduce another variable, output type, into the experiment. The container type used to create the set comprehension is the only difference between these two cases.