They are part of the Python syntax and unlike using single (') or double (") quotes, they can pretty much never be interchanged.

Square and rounded brackets can mean so many different things in different circumstances. Just to give an example, one may think that both the following are identical:

a = [1,2,3]
a = (1,2,3)

as a[0] gives 1 in both cases. However, the first one is creating a list whereas the second is a tuple. These are different data types and not knowing the distinction can lead to difficulties.

Above is just one example where square and rounded brackets differ but there are many, many others. For example, in an expression such as:

4 * ((12 + 6) / 9)

using square brackets would lead to a syntax error as Python would think you were trying to create a nested list:

4 * [[12 + 6] / 9]

So hopefully you can see from above, that the two types of brackets do completely different things in situations which seem identical. There is no real rule of thumb for when one type does what. In general, I guess that square brackets are used mainly for lists and indexing things whereas rounded brackets are for calculations (as you would in maths) and functions etc.

Hope this helps you out a bit!

Answer from Joe Iddon on Stack Overflow
🌐
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 - Brief description on when to use parentheses `()`, square brackets `[]` and curly braces `{}` in python
🌐
GeeksforGeeks
geeksforgeeks.org › python › parentheses-square-brackets-and-curly-braces-in-python
Parentheses, Square Brackets and Curly Braces in Python - GeeksforGeeks
July 26, 2025 - Curly braces define dictionaries and sets, both of which are mutable collections. Square brackets are crucial for defining lists and accessing elements through indexing and slicing.
Discussions

In python, when to use a square or round brackets? - Stack Overflow
I'm a non programmer who just started learning python (version 3) and am getting a little confused about when a square bracket is needed in my code vs round bracket. Is there a general rule of thumb? More on stackoverflow.com
🌐 stackoverflow.com
Meaning of square brackets
HI I wonder if any one can help me understanding the use of the square brackets on the end of this statement. mail_ids = mails[0].decode().split()[-2:] How does the [-2:] work? thanks dazza000 More on discuss.python.org
🌐 discuss.python.org
0
0
October 24, 2022
What's the difference between lists enclosed by square brackets and parentheses in Python? - Stack Overflow
You can read about tuples in the Python tutorial. While you can mutate lists, this is not possible with tuples. In [1]: x = (1, 2) In [2]: x[0] = 3 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/user/ in () TypeError: 'tuple' object does not support item assignment ... Another way brackets and parentheses differ is that square ... More on stackoverflow.com
🌐 stackoverflow.com
Why Square Brackets in Dictionaries
Hello, Why do I need to use square brackets when accessing the value from a dictionary like in the code below: d = {} d[“laptop”] = 40000 d[“mobile”] = 15000 d[“earphone”] = 1000 print(d[“mobile”]) More on discuss.python.org
🌐 discuss.python.org
0
0
June 11, 2025
🌐
SheCodes
shecodes.io › athena › 2453-how-to-use-square-bracket-syntax-in-python
[Python] - How to Use Square Bracket Syntax in Python - | SheCodes
Learn what square bracket syntax is and how to use it to access elements of an array or dictionary in Python.
Top answer
1 of 3
14

They are part of the Python syntax and unlike using single (') or double (") quotes, they can pretty much never be interchanged.

Square and rounded brackets can mean so many different things in different circumstances. Just to give an example, one may think that both the following are identical:

a = [1,2,3]
a = (1,2,3)

as a[0] gives 1 in both cases. However, the first one is creating a list whereas the second is a tuple. These are different data types and not knowing the distinction can lead to difficulties.

Above is just one example where square and rounded brackets differ but there are many, many others. For example, in an expression such as:

4 * ((12 + 6) / 9)

using square brackets would lead to a syntax error as Python would think you were trying to create a nested list:

4 * [[12 + 6] / 9]

So hopefully you can see from above, that the two types of brackets do completely different things in situations which seem identical. There is no real rule of thumb for when one type does what. In general, I guess that square brackets are used mainly for lists and indexing things whereas rounded brackets are for calculations (as you would in maths) and functions etc.

Hope this helps you out a bit!

2 of 3
7

It's hard to answer succinctly, but I can give you some common examples.

Square brackets define lists:

my_list = [1, 2, 3, 4]

They are also used for indexing lists. For instance:

print(my_list[1])

Returns 2. Additionally, they are frequently used to index dictionaries, which are defined with curly brackets:

my_dict = {5:'a', 6:'b', 7:'c'}

The indexing for dictionaries requires that I input the "key" as follows:

print(my_dict[6])

Returns b.

Functions are called using round brackets. For instance, if I want to add an element to my list, I can call the append() function:

my_list.append(8)

I have just added 8 to my list. You will notice that when I called the print function I also used curved brackets.

This is by no means comprehensive, but hopefully it will give a starting point.

🌐
Python.org
discuss.python.org › python help
Meaning of square brackets - Python Help - Discussions on Python.org
October 24, 2022 - HI I wonder if any one can help me understanding the use of the square brackets on the end of this statement. mail_ids = mails[0].decode().split()[-2:] How does the [-2:] work? thanks dazza000
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).

🌐
Python.org
discuss.python.org › python help
Why Square Brackets in Dictionaries - Python Help - Discussions on Python.org
June 11, 2025 - Hello, Why do I need to use square brackets when accessing the value from a dictionary like in the code below: d = {} d[“laptop”] = 40000 d[“mobile”] = 15000 d[“earphone”] = 1000 print(d[“mobile”])
Find elsewhere
🌐
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.
🌐
Processing
py.processing.org › reference › indexbrackets
[] (Index brackets) \ Language (API)
Python Mode for Processing extends the Processing Development Environment with the Python programming language.
🌐
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.
🌐
Reddit
reddit.com › r/learnpython › question regarding using square brackets to access values of variables
r/learnpython on Reddit: Question regarding using square brackets to access values of variables
February 4, 2025 -

Hello,

Please review the code in bold.

My question is in both examples,

Example 1.

python_topics = ["variables", "control flow", "loops", "modules", "classes"]

length = len(python_topics)

index = 0

while index < length:

print("I am learning about " + python_topics[index])

index += 1

Example 2.

favorite_fruit = "blueberry"

last_char = favorite_fruit**[len(favorite_fruit) - 1]**

Output: Y

My question is, their a way to describe what the square brackets are doing? Would you say that the square brackets are used to access or transfer the value of the variable? Hopefully this question makes sense. Thank you very much.

🌐
YouTube
youtube.com › watch
How to Use Square Brackets in Python - YouTube
Using Python parentheses correctly is important to avoid syntax errors. We continue our three-part Python Parentheses series with square brackets. Square bra...
Published   March 7, 2023
🌐
DataCamp
campus.datacamp.com › courses › intermediate-python › dictionaries-pandas
Square Brackets (1) - Intermediate Python
The single bracket version gives a Pandas Series, the double bracket version gives a Pandas DataFrame. ... Use single square brackets to print out the country column of cars as a Pandas Series.
🌐
Python.org
discuss.python.org › python help
Tuple declaration using square brackets - Python Help - Discussions on Python.org
July 21, 2022 - I sometimes see this Tuple declaration which is not common: VARIABLE = Tuple[List[Tuple[str, float, Dict[str, Any]]], Dict[str, str]] VAR = Tuple[…] I was expecting Tuple with parentheses. Any help to understand? Tha…
🌐
Runestone Academy
runestone.academy › ns › books › published › fopp › Sequences › IndexOperatorWorkingwiththeCharactersofaString.html
6.3. Index Operator: Working with the Characters of a String — Foundations of Python Programming
The indexing operator (Python uses square brackets to enclose the index) selects a single character from a string. The characters are accessed by their position or index value.
🌐
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: ...
🌐
Oreate AI
oreateai.com › blog › understanding-the-role-of-square-brackets-in-python › 11e53ced7a30c49381742208fbb219e6
Understanding the Role of Square Brackets in Python - Oreate AI Blog
January 16, 2026 - Square brackets in Python are essential for creating lists and accessing elements through indexing and slicing while enhancing readability.
🌐
Reuven Lerner
lerner.co.il › home › blog › python › python parentheses primer
Python parentheses primer — Reuven Lerner
November 10, 2022 - The square brackets tell Python that this is a list comprehension, producing a list.
🌐
Kodeclik
kodeclik.com › brackets-in-python
Brackets in Python: Parentheses, Square Brackets and Curly Braces
March 21, 2025 - In Python, there are three types of brackets—parentheses (), square brackets [], and curly braces {}. They serve distinct purposes, each essential for different aspects of programming.
🌐
Quora
quora.com › Can-you-explain-the-difference-between-square-brackets-and-curly-brackets-in-Python
Can you explain the difference between square brackets and curly brackets in Python? - Quora
Answer: Meet Jon, standing in lane 1. He’s a curly bracket: His job is important but tedious. He is a librarian of sorts but his official name is the hash-mapper (with a nod to Mad Hatter). He has to know which box contains what item: In the jargon (at work), the ‘box’ (a or b) is called a key ...