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.

🌐
Infx511
infx511.github.io › lists.html
Chapter 4 Lists and Sequences | Introduction to Programming
A list is a mutable, ordered sequence of values that are all stored in a single variable. For example, you can make a list names that contains the strings “Sarah”, “Amit”, and “Zhang”, or a list one_to_seventy that stores the numbers from 1 to 70.
Discussions

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
List VS Sequence: Does order matter?
Does the order of a list matter? What do you mean by "list" here? That's not mathematical terminology. Does the order of a sequence matter? Yes. I have been lead to believe these two mathematical data structures are the same, with the exception of order but I cannot remember which has the order restriction. The one that where order doesn't matter is a set. The one where order does matter is a tuple (pair if there's only two elements in the tuple, triple if there are three), or "sequence", especially if it's an infinitely long tuple. "List" isn't mathematical terminology and could refer to either depending on the context. More on reddit.com
🌐 r/MathHelp
2
1
February 10, 2018
🌐
HackMD
hackmd.io › @vickyliin › ry66U__s0
Python Invariance: list vs. Sequence - HackMD
August 25, 2024 - This means you can't add or remove items from a `Sequence`. This key difference makes it safe for `Sequence` to be covariant: ```python from typing import Sequence def process_animals(animals: Sequence[Animal]): for animal in animals: animal.make_sound() # We can't add to the sequence here dogs: list[Dog] = [Dog(), Dog()] process_animals(dogs) # This works fine ``` Key points: 1.
🌐
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. A sequence can be homogeneous or heterogeneous. In a homogeneous sequence, all elements have the same type. For example, strings are homogeneous sequences where each element is of the same type.
🌐
Python Like You Mean It
pythonlikeyoumeanit.com › Module2_EssentialsOfPython › SequenceTypes.html
Sequence Types — Python Like You Mean It
Find where that first entry is, and change it to -5. For example (1, 2, 5, 0, 5) \(\rightarrow\) (1, 2, -5, 0, 5). Given a sequence, x, and a valid negative index for x, neg_index, find the corresponding positive-value for that index. That is, if x = "cat", and neg_index = -3, which is the negative index that would return "c", then you would want to return the index 0. ... We have been introduced to three Python types that are sequential in nature: strings, lists, and tuples.
🌐
Art of Problem Solving
artofproblemsolving.com › wiki › index.php › Sequence_(Python)
Sequence (Python) - AoPS Wiki
For example, [1,11]*3 will evaluate to [1,11,1,11,1,11]. x in mySeq will return True if x is an element of mySeq, and False otherwise. You can negate this statement with either not (x in mySeq) or x not in mySeq. mySeq[i] will return the i'th character of mySeq.
🌐
Makitweb
makitweb.com › home › python › sequences and lists in python
Sequences and Lists in Python
June 28, 2022 - In Python, a sequence is a set of ordered list. They are differentiated by their index number. The index starts from zero.
Find elsewhere
🌐
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 - str1 = "Gaurav " + "Verma" print(str1) #output is " Gaurav Verma" tuple1 = (1, 2, 3) + (4, 5, 6) print(tuple1) #output is (1, 2, 3, 4, 5, 6) list1 = [1, 2, 3] + ["4", "5"] print(list1) #output is [1, 2, 3, "4", "5"} 2. * : repeats the sequence.
🌐
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 of Python and is widely used in Data Science or Machine Learning.
🌐
pythontutorials
pythontutorials.net › blog › difference-between-list-sequence-and-slice-in-python
Python: Difference Between List, Sequence, and Slice Explained — pythontutorials.net
For example: Slicing a list returns a new list. Slicing a string returns a new string. Slicing a tuple returns a new tuple. Let’s use the list numbers = [0, 1, 2, 3, 4, 5] to demonstrate: Slicing works identically across all sequence types: ...
🌐
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. The values in list are called elements or sometimes items. There are several ways to create a new list; the simplest is to enclose the elements in square brackets (“[” ...
🌐
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 - You can think of it like a shopping list that contains multiple items. For example, you could have a list of numbers like [1, 2, 3, 4, 5] or a list of names like ["John", "Jane", "Bob", "Sue"].
🌐
NxtWave
ccbp.in › blog › articles › sequence-in-python
Sequence in Python: Types, Methods & Examples
Sequence in Python is divided into two main types: mutable and immutable. Learning the difference between them is important because it affects how data can be changed during a program's execution. Mutable sequences are structures you can change after creating them. You can add, remove, or modify elements within these sequences. Examples are: Lists are flexible and mostly used in Python.
🌐
DataFlair
data-flair.training › blogs › python-sequence
Python Sequence and Collections - Operations, Functions, Methods - DataFlair
April 21, 2026 - Hi Anumula Thanks for reading the Python Sequence tutorial. We didn’t get your point. You have written the same thing which you mention as an error. Still, we have checked this there is no need to do changes. We request you to check again and tell us your query. DataFlair Team. ... You can think of a hash as a unique value for each input. All the mutable objects are unhashable, Example of mutable/unhashable are list, sets, and dictionary.
🌐
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 - Explain in simple terms what list('some string') does. ... The objects in a sequence are ordered. For example, the string ‘AB’ is not the same as ‘BA’.
🌐
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?

🌐
Wikibooks
en.wikibooks.org › wiki › Python_Programming › Sequences
Python Programming/Sequences - Wikibooks, open books for an open world
You could consider a list to be a special kind of dictionary, in which the key of every element is a number, in numerical order. Dictionaries are declared using curly braces, and each element is declared first by its key, then a colon, and then its value. For example: >>> definitions = {"guava": "a tropical fruit", "python": "a programming language", "the answer": 42} >>> definitions {'python': 'a programming language', 'the answer': 42, 'guava': 'a tropical fruit'} >>> definitions["the answer"] 42 >>> definitions["guava"] 'a tropical fruit' >>> len(definitions) 3
🌐
Real Python
realpython.com › ref › glossary › sequence
sequence | Python Glossary – Real Python
Sequences allow you to store multiple values in a single container object. You can access each value by its position (index) within the sequence. Lists, tuples, and strings are common examples of sequences in Python.
🌐
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 - Another benefit of Sequence is that it can accept a much wider variety of types (including custom classes written by you). This makes it much easier to write functions that are re-usable and compose well together. Consider my earlier double_then_sum function. But this time I’ve got an input that’s a tuple. This seems like a perfectly valid use-case. There’s no reason why I should have to convert this to a 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.