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
🌐
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 ...
🌐
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
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
Brackets where to use
https://www.pythoncheatsheet.org/cheatsheet/basics More on reddit.com
🌐 r/learnpython
14
5
May 26, 2024
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
🌐
Manning
livebook.manning.com › concept › python › square-bracket
square-bracket in python
liveBooks are enhanced books. They add narration, interactive exercises, code execution, and other features to eBooks.
🌐
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.
🌐
Python documentation
docs.python.org › 3 › tutorial › datastructures.html
5. Data Structures — Python 3.14.3 documentation
squares = [x**2 for x in range(10)] which is more concise and readable. A list comprehension consists of brackets containing an expression followed by a for clause, then zero or more for or if clauses.
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.

Find elsewhere
🌐
Sololearn
sololearn.com › en › Discuss › 3096479 › why-square-bracket-use-in-python
Why square bracket [ ]use in python | Sololearn: Learn to code for FREE!
October 22, 2022 - sumit budhwani , if you are really interested in python, i would suggest you to start learning from the tutorial *python for beginners*. do not skip this basic tutorial.
🌐
Processing
py.processing.org › reference › indexbrackets
[] (Index brackets) \ Language (API)
Python Mode for Processing extends the Processing Development Environment with the Python programming language.
🌐
Coderanch
coderanch.com › t › 737170 › languages › square-brackets-print-line
What are the square brackets around the print line used for? (Jython/Python forum at Coderanch)
November 30, 2020 - In a lot of languages, there exists a standard syntax for declaring (and displaying) complex objects. The "[]" bracket an array or list (sequential collection) The "{}" bracket a dictionary entry or object with properties: {name: value} or {name, v1= value1, v2=value2, …} The exact format ...
🌐
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
🌐
Oreate AI
oreateai.com › blog › understanding-the-role-of-square-brackets-in-python › ba5565725b76a351cf25f26a25eadc6b
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.
🌐
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.
🌐
FastAPI
fastapi.tiangolo.com › python-types
Python Types Intro - FastAPI
Those internal types in the square brackets are called "type parameters".
🌐
NumPy
numpy.org › doc › stable › user › absolute_beginners.html
NumPy: the absolute basics for beginners — NumPy v2.4 Manual
One way to initialize an array is using a Python sequence, such as a list. For example: >>> a = np.array([1, 2, 3, 4, 5, 6]) >>> a array([1, 2, 3, 4, 5, 6]) Elements of an array can be accessed in various ways. For instance, we can access an individual element of this array as we would access an element in the original list: using the integer index of the element within square brackets.
🌐
Python
docs.python.org › 3 › glossary.html
Glossary — Python 3.14.3 documentation
The default Python prompt of the interactive shell when entering the code for an indented code block, when within a pair of matching left and right delimiters (parentheses, square brackets, curly braces or triple quotes), or after specifying a decorator.
🌐
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”])
🌐
Medium
medium.com › @mydotanis_1814 › understanding-square-brackets-in-python-ee8b5288fc15
Understanding Square Brackets [ ] in Python | by MYAns | Medium
March 3, 2025 - Understanding Square Brackets [ ] in Python 1. Creating a List The [ ] sign is most commonly used to create lists, which are data structures that can store multiple values and are …
🌐
Python.org
discuss.python.org › python help
The —alleged — Square Brackets Mistery of writerow() - Python Help - Discussions on Python.org
August 9, 2024 - It said that I need to use square brackets withing the writerow() method. Like this: csv.writer.writerow([value1,value2,value3]) I do not understand the reason behind creating this method to accept arguments in this square brackets form. What difference does it make for the method to accept ...
🌐
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.