You're mixing very different things in your question, so I'll just answer a different question

You are now asking about one of the most important interface in Python: iterable - it's basically anything you can use like for elem in iterable.

iterable has three descendants: sequence, generator and mapping.

  • A sequence is a iterable with random access. You can ask for any item of the sequence without having to consume the items before it. With this property you can build slices, which give you more than one element at once. A slice can give you a subsequence: seq[from:until] and every nth item: seq[from:until:nth]. list, tuple and str all are sequences.

  • If the access is done via keys instead of integer positions, you have a mapping. dict is the basic mapping.

  • The most basic iterable is a generator. It supports no random access and therefore no slicing. You have to consume all items in the order they are given. Generator typically only create their items when you iterate over them. The common way to create generators are generator expressions. They look exactly like list comprehension, except with round brackets, for example (f(x) for x in y). Calling a function that uses the yield keyword returns a generator too.

The common adapter to all iterables is the iterator. iterators have the same interface as the most basic type they support, a generator. They are created explicitly by calling iter on a iterable and are used implicitly in all kinds of looping constructs.

Answer from Jochen Ritzel on Stack Overflow
Top answer
1 of 5
119

You're mixing very different things in your question, so I'll just answer a different question

You are now asking about one of the most important interface in Python: iterable - it's basically anything you can use like for elem in iterable.

iterable has three descendants: sequence, generator and mapping.

  • A sequence is a iterable with random access. You can ask for any item of the sequence without having to consume the items before it. With this property you can build slices, which give you more than one element at once. A slice can give you a subsequence: seq[from:until] and every nth item: seq[from:until:nth]. list, tuple and str all are sequences.

  • If the access is done via keys instead of integer positions, you have a mapping. dict is the basic mapping.

  • The most basic iterable is a generator. It supports no random access and therefore no slicing. You have to consume all items in the order they are given. Generator typically only create their items when you iterate over them. The common way to create generators are generator expressions. They look exactly like list comprehension, except with round brackets, for example (f(x) for x in y). Calling a function that uses the yield keyword returns a generator too.

The common adapter to all iterables is the iterator. iterators have the same interface as the most basic type they support, a generator. They are created explicitly by calling iter on a iterable and are used implicitly in all kinds of looping constructs.

2 of 5
19
  • list are more than plain arrays. You can initialize them without giving the number of items. You can append/push to them, you can remove/pop/del items from them, you can have lists of different types of objects (e.g., [1,'e', [3]]), you can have recursive lists... and you can slice lists, which means getting a new list with only a few of the items.
  • slice are an object type used "behind the scenes" to handle extended slicing in the a[start:stop:step] form, as help(slice) reveals.

"Sequence" is not an object, more like an informal interface some objects like list implement.

🌐
Reddit
reddit.com › r/askcomputerscience › is there an important difference between a sequence and a list?
r/AskComputerScience on Reddit: Is there an important difference between a sequence and a list?
December 26, 2025 -

In mathematics, we define the notion of a sequence to basically be list (or tuple, or whatever) of elements. Sequences can also be infinite. And they are sometimes understood to actually be equivalent to functions with domain equal to the natural numbers, or something like that.

In computer science we talk about lists instead of sequences, usually. Lists are almost always finite, although with lazy function evaluation, you can make an infinite list data structure in OCaml. I'm not exactly sure how you would "formally" define lists, in a way that is analogous to what they do in mathematics.

But at a high level, they seem like exactly the same thing. Just one is thought of from a mathematics perspective and the other from computer science.

Is there a difference?

Discussions

Question about python types: What's the difference between a types.Sequence and types.Iterable?
Sequences need to implement __len__ and __getitem__ in addition to being iterable. More on reddit.com
🌐 r/learnpython
12
3
February 25, 2021
Is there an important difference between a sequence and a list?
At a high level of abstraction the two may be interchangeable. You have a generation rule, like the Fibonacci sequence, which can generate a sequence of numbers when evaluated, you have the sequence of numbers which is infinite in principle, you have the list of numbers that is finite in so far as you have evaluated it so far, and you have the data structure for storing the evaluated numbers, which may be a linked list (but could just as easily be a vector or most any iterable container). Sure, if you zoom out far enough you could claim that all of these are the same, the latter are just implementation details for the former. But depending on what you're doing, having vocabulary to distinguish between those four layers of the concept could be useful. More on reddit.com
🌐 r/AskComputerScience
17
10
December 26, 2025
Is there any difference between tuples, ordered lists and sequences?
Mathematically, they are essentially the same, however, while sequences are typically infinite, tuples and ordered lists are typically not (although we could define them to be, without too much trouble). From the wikipedia page on tuples: In mathematics, a tuple is a finite ordered list (sequence) of elements. More on reddit.com
🌐 r/learnmath
2
1
May 26, 2022
[Python Question] Are all sequences iterable/all iterables sequences?
The Python documentation's glossary defines a sequence as An iterable which supports efficient element access using integer indices via the getitem() special method and defines a len() method that returns the length of the sequence. More on reddit.com
🌐 r/learnprogramming
3
1
November 24, 2015
🌐
HackMD
hackmd.io › @vickyliin › ry66U__s0
Python Invariance: list vs. Sequence - HackMD
August 25, 2024 - ## Conclusion The invariance of `list` and the covariance of `Sequence` in Python serve different purposes: - `list` being invariant prevents type errors that could occur from modifying the list. - `Sequence` being covariant allows for more flexible use of read-only sequences, without the risk of modification-related type errors.
🌐
Infx511
infx511.github.io › lists.html
Chapter 4 Lists and Sequences | Introduction to Programming
In Python, lists are the most common example of a sequence data structure.
🌐
Python Like You Mean It
pythonlikeyoumeanit.com › Module2_EssentialsOfPython › SequenceTypes.html
Sequence Types — Python Like You Mean It
The preceding reading introduced Python lists and strings, two important objects that are built into the Python language. Although quite distinct from one another in terms of what they can contain, lists and strings are both types of sequences - they store a finite collection of objects whose ordering matters (e.g.
🌐
Art of Problem Solving
artofproblemsolving.com › wiki › index.php › Sequence_(Python)
Sequence (Python) - AoPS Wiki
In Python, sequence is the generic term for an ordered set. There are several types of sequences in Python, the following three are the most important. Lists are the most versatile sequence type. The elements of a list can be any object, and lists are mutable - they can be changed.
🌐
Python Tutorial
pythontutorial.net › home › advanced python › python sequences
Python Sequences
March 27, 2025 - Python classifies sequence types as mutable and immutable. The mutable sequence types are lists and bytearrays while the immutable sequence types are strings, tuples, range, and bytes.
Find elsewhere
🌐
Amity Online
amityonline.com › blog › understanding-sequences-in-python
Types of Sequence in Python: A Comprehensive Guide
July 11, 2025 - On the other hand, immutable sequences ... sequences. Since they are unchangeable, immutable sequences are thread-safe. A list in Python is a simple and flexible way to store collected items....
🌐
MeadSteve's Dev Blog
blog.meadsteve.dev › programming › 2023 › 09 › 09 › typed-python-prefer-sequence-over-list
Typed Python: Choose Sequence over List – MeadSteve's Dev Blog
September 9, 2023 - So if I pass the function a list of integers the type checker can ensure that it stays as a list of integers. Another benefit of Sequence is that it can accept a much wider variety of types (including custom classes written by you).
🌐
Medium
medium.com › @madhuri15 › python-sequence-lists-a-complete-guide-54ec7ed88323
Python Sequence — Lists a complete guide | by Madhuri Patil | Medium
December 27, 2022 - Sequences in Python distinguish by their mutability. A mutable sequence can update or change, while immutable sequences can not alter once created. The list is one of the four built-in sequence types of Python and it is an essential element ...
🌐
Kkiesling
kkiesling.github.io › python-novice-gapminder-custom › 05a-sequence-types
Plotting and Programming in Python: Sequence Types: Strings, Tuples and Lists
August 28, 2018 - In contrast, lists are mutable: they can be modified in place. ... A slice is a part of a sequence.
🌐
Medium
medium.com › @gauravverma.career › sequence-in-python-705f9904313f
Sequence in Python. Sequence is any ordered set in python… | by Gaurav Verma | Medium
December 7, 2025 - List: List is mutable and can store any type of object. Tuple: Tuple is immutable and can store any type of object. String: String is sequence which can store only characters e.g.
🌐
Runestone Academy
runestone.academy › ns › books › published › py4e-int › lists › sequence.html
9.1. A list is a sequence — Python for Everybody - Interactive
Like a string, a list is a sequence of values. In a string, the values are characters; in a list, they can be any type.
🌐
TutorialsPoint
tutorialspoint.com › article › What-are-the-differences-between-list-sequence-and-slice-data-types-in-Python
What are the differences between list, sequence and slice data types in Python?
May 8, 2023 - In Python, a sequence is a type of data that represents a sequence of values. This could be a string of characters, like "hello" or a range of numbers, like 1 to 10. You can think of a sequence like a line of people waiting to get into a concert. Each person has a specific place in the line, just like each value in a sequence has a specific position. Slices ? A slice is a way to extract a part of a list or sequence.
🌐
DataFlair
data-flair.training › blogs › python-sequence
Python Sequence and Collections - Operations, Functions, Methods - DataFlair
April 21, 2026 - Python offers six types of sequences. Let’s discuss them. A string is a group of characters. Since Python has no provision for arrays, we simply use strings. This is how we declare a string in Python: ... We can use a pair of single or double quotes. And like we’ve always said, Python is dynamically-typed. Every string object is of the type ‘str’. ... Since Python does not have arrays, it has lists.
🌐
Python Morsels
pythonmorsels.com › sequence
Sequences in Python - Python Morsels
June 10, 2026 - Sequences are iterables that have a length. Sequences are ordered collections (they maintain the order of their contents). The most common sequences built-in to Python are string, tuple, and list.
🌐
Fsu
ww2.cs.fsu.edu › ~nienaber › teaching › python › lectures › sequence-list.html
Sequences | List
Sequences are an object type in Python that allows the user to store data one after each other. Operations can be performed on a sequence, to examined and manipulated the stored items. There are several different types of sequence objects in Python. We will focus on the string and list.
🌐
Compciv
2017.compciv.org › guide › cookbook › basic-sequences.html
Python Sequence Basics
This includes strings, which are sequences of characters. To convert a Python string into a tuple in which each element of the tuple is a separate character, use the tuple() class function and pass in a string: ... The Python list is an ordered sequence of elements.
🌐
The Python Coding Stack
thepythoncodingstack.com › the python coding stack › sequences in python (data structure categories #2)
Sequences in Python (Data Structure Categories #2)
June 25, 2024 - And you're likely to see common ... start with the headline difference between the two terms: A Python sequence is an iterable that you can index using an integer....