Square brackets are lists while parentheses are tuples.

A list is mutable, meaning you can change its contents:

>>> x = [1,2]
>>> x.append(3)
>>> x
[1, 2, 3]

while tuples are not:

>>> x = (1,2)
>>> x
(1, 2)
>>> x.append(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'append'

The other main difference is that a tuple is hashable, meaning that you can use it as a key to a dictionary, among other things. For example:

>>> x = (1,2)
>>> y = [1,2]
>>> z = {}
>>> z[x] = 3
>>> z
{(1, 2): 3}
>>> z[y] = 4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

Note that, as many people have pointed out, you can add tuples together. For example:

>>> x = (1,2)
>>> x += (3,)
>>> x
(1, 2, 3)

However, this does not mean tuples are mutable. In the example above, a new tuple is constructed by adding together the two tuples as arguments. The original tuple is not modified. To demonstrate this, consider the following:

>>> x = (1,2)
>>> y = x
>>> x += (3,)
>>> x
(1, 2, 3)
>>> y
(1, 2)

Whereas, if you were to construct this same example with a list, y would also be updated:

>>> x = [1, 2]
>>> y = x
>>> x += [3]
>>> x
[1, 2, 3]
>>> y
[1, 2, 3]
Answer from jterrace on Stack Overflow
Top answer
1 of 7
332

Square brackets are lists while parentheses are tuples.

A list is mutable, meaning you can change its contents:

>>> x = [1,2]
>>> x.append(3)
>>> x
[1, 2, 3]

while tuples are not:

>>> x = (1,2)
>>> x
(1, 2)
>>> x.append(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'append'

The other main difference is that a tuple is hashable, meaning that you can use it as a key to a dictionary, among other things. For example:

>>> x = (1,2)
>>> y = [1,2]
>>> z = {}
>>> z[x] = 3
>>> z
{(1, 2): 3}
>>> z[y] = 4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

Note that, as many people have pointed out, you can add tuples together. For example:

>>> x = (1,2)
>>> x += (3,)
>>> x
(1, 2, 3)

However, this does not mean tuples are mutable. In the example above, a new tuple is constructed by adding together the two tuples as arguments. The original tuple is not modified. To demonstrate this, consider the following:

>>> x = (1,2)
>>> y = x
>>> x += (3,)
>>> x
(1, 2, 3)
>>> y
(1, 2)

Whereas, if you were to construct this same example with a list, y would also be updated:

>>> x = [1, 2]
>>> y = x
>>> x += [3]
>>> x
[1, 2, 3]
>>> y
[1, 2, 3]
2 of 7
14

One interesting difference :

lst=[1]
print lst          // prints [1]
print type(lst)    // prints <type 'list'>

notATuple=(1)
print notATuple        // prints 1
print type(notATuple)  // prints <type 'int'>
                                         ^^ instead of tuple(expected)

A comma must be included in a tuple even if it contains only a single value. e.g. (1,) instead of (1).

🌐
Codecademy
codecademy.com › learn › cspath-cs-101 › modules › cspath-python-lists › cheatsheet
CS101: Introduction to Programming: Python: Lists Cheatsheet | Codecademy
In Python, lists are ordered collections of items that allow for easy use of a set of data. List values are placed in between square brackets [ ], separated by commas. It is good practice to put a space between the comma and the next value.
Discussions

Remove brackets and appostrophes from the list
Hello All…I got a simple request, until now cant find solution from google. I want to remove rackets and appostrophes from the list. Ex. list = [3,4,5,] result is = 3,4,5 I tried copy many code but the best i got is = ‘3,4,5’ Please help…thanks More on discuss.python.org
🌐 discuss.python.org
0
0
April 5, 2023
Brackets where to use
https://www.pythoncheatsheet.org/cheatsheet/basics More on reddit.com
🌐 r/learnpython
14
5
May 26, 2024
Adding brackets to a list and sort it
Hello, I have the following assignment: Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() method. The program should build a list of words. For each word on each line check to see if the word is already in the list and if ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
0
January 17, 2023
Meaning of square brackets
Ok, I think I have got it now. it is about the indexing of a list. I think it is referring to the last two elements of the list called mails · The first thing to understand is that the output from split() is a list. See the documentation for str.split(). A list is a sequence type · The second ... More on discuss.python.org
🌐 discuss.python.org
0
0
October 24, 2022
🌐
Data Science Discovery
discovery.cs.illinois.edu › guides › Python-Fundamentals › brackets
Parentheses, Square Brackets and Curly Braces in Python - Data Science Discovery
March 22, 2024 - Moreover, it may contain heterogeneous ... of elements is needed. ... Creating Lists Square brackets can be used to create a list, an ordered and mutable collection of elements....
🌐
Processing
py.processing.org › reference › indexbrackets
[] (Index brackets) \ Language (API)
Python Mode for Processing extends the Processing Development Environment with the Python programming language.
🌐
Python.org
discuss.python.org › python help
Remove brackets and appostrophes from the list - Python Help - Discussions on Python.org
April 5, 2023 - Hello All…I got a simple request, until now cant find solution from google. I want to remove rackets and appostrophes from the list. Ex. list = [3,4,5,] result is = 3,4,5 I tried copy many code but the best i got is …
🌐
freeCodeCamp
forum.freecodecamp.org › python
Adding brackets to a list and sort it - Python - The freeCodeCamp Forum
January 17, 2023 - Hello, I have the following assignment: Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() method. The program should build a list of words. For each word on each line check to see if the word is already in the list and if ...
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › parentheses-square-brackets-and-curly-braces-in-python
Parentheses, Square Brackets and Curly Braces in Python - GeeksforGeeks
July 26, 2025 - For example, my_list[0] or my_string[1:4] . ... In conclusion, understanding the differences between parentheses (), curly braces {}, and square brackets [] in Python is essential for writing clear, efficient, and well-structured code. Parentheses are versatile, used for function calls, defining tuples, and grouping expressions.
🌐
Python.org
discuss.python.org › python help
Meaning of square brackets - Python Help - Discussions on Python.org
October 24, 2022 - Ok, I think I have got it now. it is about the indexing of a list. I think it is referring to the last two elements of the list called mails · The first thing to understand is that the output from split() is a list. See the documentation for str.split(). A list is a sequence type · The second ...
🌐
Quora
quora.com › What-is-the-use-of-square-brackets-in-Python-except-list
What is the use of square brackets in Python, except list? - Quora
Answer (1 of 4): [] apart from being used to represent an empty list can also be used in the following ways: array indexing: [code]a = [1, 2, 3, 4, 5] # access first element print(a[0]) # access last element print(a[-1]) [/code]dictionary indexing: ...
🌐
Open Book Project
openbookproject.net › books › bpp4awd › ch03.html
3. Strings, lists and tuples — Beginning Python Programming for Aspiring Web Developers
In the case of lists or tuples, they are made up of elements, which are values of any Python datatype, including other lists and tuples. Lists are enclosed in square brackets ([ and ]) and tuples in parentheses (( and )).
🌐
Plain English
python.plainenglish.io › pythons-brackets-parentheses-and-curly-braces-60cdc236cdd6
Python’s Brackets, Parentheses, and Curly Braces | by Emmanuel Adebanjo | Python in Plain English
August 22, 2023 - Python’s Brackets, Parentheses, and Curly Braces Brackets — [], parentheses — (), & curly braces — {} are fundamental concepts that should be understood when dealing with the Python …
Top answer
1 of 4
82

Square brackets: []

Lists and indexing/lookup/slicing

  • Lists: [], [1, 2, 3], [i**2 for i in range(5)]
  • Indexing: 'abc'[0]'a'
  • Lookup: {0: 10}[0]10
  • Slicing: 'abc'[:2]'ab'

Parentheses: () (AKA "round brackets")

Tuples, order of operations, generator expressions, function calls and other syntax.

  • Tuples: (), (1, 2, 3)
    • Although tuples can be created without parentheses: t = 1, 2(1, 2)
  • Order of operations: (n-1)**2
  • Generator expressions: (i**2 for i in range(5))
  • Function or method calls: print(), int(), range(5), '1 2'.split(' ')
    • with a generator expression: sum(i**2 for i in range(5))

Curly braces: {}

Dictionaries and sets, as well as in string formatting

  • Dicts: {}, {0: 10}, {i: i**2 for i in range(5)}
  • Sets: {0}, {i**2 for i in range(5)}
    • Except the empty set: set()
  • In string formatting to indicate replacement fields:
    • F-strings: f'{foobar}'
    • Format strings: '{}'.format(foobar)

Regular expressions

All of these brackets are also used in regex. Basically, [] are used for character classes, () for grouping, and {} for repetition. For details, see The Regular Expressions FAQ.

Angle brackets: <>

Used when representing certain objects like functions, classes, and class instances if the class doesn't override __repr__(), for example:

>>> print
<built-in function print>
>>> zip
<class 'zip'>
>>> zip()
<zip object at 0x7f95df5a7340>

(Note that these aren't proper Unicode angle brackets, like ⟨⟩, but repurposed less-than and greater-than signs.)

2 of 4
5

In addition to Maltysen's answer and for future readers: you can define the () and [] operators in a class, by defining the methods:

  • __call__(self[, args...]) for ()
  • __getitem__(self, key) for []

An example is numpy.mgrid[...]. In this way you can define it on your custom-made objects for any purpose you like.

🌐
UC Berkeley Statistics
stat.berkeley.edu › ~spector › extension › python › notes › node28.html
List Data
To access the individual elements of a list, use square brackets after the list's name surrounding the index of the desired element. Recall that the first element of a sequence in python is numbered zero. Thus, to extract the abs function from mylist in the example above, we would refer to ...
🌐
Edlitera
edlitera.com › blog › posts › python-parentheses
Python Parentheses Cheat Sheet | Edlitera
In this article, I've demonstrated some of the different uses for standard parentheses, square brackets, and curly braces in Python that you can use as a cheat sheet.
🌐
Educative
educative.io › answers › python-data-structures
Python data structures
A data structure that stores an ordered collection of items in Python is called a list. A list is generally represented within square brackets [] and can contain elements of different data types.
🌐
Tutorials
onlinetutorialhub.com › home › python tutorial › brackets, braces and parentheses in python
Brackets, Braces and Parentheses in Python
May 10, 2025 - The distinct functions of brackets [], braces, and brackets () in Python are mostly associated with handling regular expressions, constructing data structures, and regulating program flow. Python, in contrast to certain other programming languages, defines code blocks largely with indentation rather than curly brackets. ... Lists are mutable data types that are created with brackets.
🌐
Reintech
reintech.io › blog › understanding-python-and-the-brackets-problem
Python and the Brackets Problem | Reintech media
October 4, 2023 - Brackets in Python play diverse roles and their usage varies depending on the context. They can denote a list, a dictionary, an array, or a tuple, and they're also used in function and method invocations.