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
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.

🌐
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 - Defining and Calling Functions To define a function in Python, the keyword def is used, followed by the function name and a pair of round brackets or parentheses.
Discussions

What's the difference between lists enclosed by square brackets and parentheses in Python? - Stack Overflow
See: Why is there no tuple comprehension in Python? ... The first is a list, the second is a tuple. Lists are mutable, tuples are not. Take a look at the Data Structures section of the tutorial, and the Sequence Types section of the documentation. ... Comma-separated items enclosed by ( and ) are tuples, those enclosed by [ and ] are lists. ... There are no lists that are enclosed by "round" brackets... More on stackoverflow.com
🌐 stackoverflow.com
Brackets where to use
https://www.pythoncheatsheet.org/cheatsheet/basics More on reddit.com
🌐 r/learnpython
14
5
May 26, 2024
Different meanings of brackets in Python - Stack Overflow
What do the 3 different brackets mean in Python programming? [] - Normally used for dictionaries, list items () - Used to identify parameters {} - I don't know what this does Can these brackets c... More on stackoverflow.com
🌐 stackoverflow.com
Should I add round brackets to my if statement, if it has more than one condition?
Personally I like option 2 with brackets. They are not needed but I find it more quickly draws the eye to where you need to look. myNumber < 4 or xy > 5 or thisIsALongName Can be harder to skim than (myNumber < 4) or (xy > 5) or thisIsALongName It might have to do with short symbols (or, <=, etc) having similar spacing patterns making them less distinguishable. I definitely wouldn't use them on x.isdigit() as that is one completely contained value, same as thisIsALongName above. More on reddit.com
🌐 r/learnpython
14
2
September 18, 2022
🌐
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.
🌐
Quora
quora.com › What-are-the-different-meanings-of-brackets-in-Python-programming
What are the different meanings of brackets in Python programming? - Quora
Round Brackets: * used to represent tuples like (1, 2, 4). * used to group expressions like in (a + b) * c + (x**p)**q - (f - g) #without brackets the expression will have different semantic.
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).

🌐
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.
Find elsewhere
🌐
Reuven Lerner
lerner.co.il › home › blog › python › python parentheses primer
Python parentheses primer — Reuven Lerner
November 10, 2022 - Note that according to PEP 8, you should write an empty list as [], without any space between the brackets. I’ve found that with certain fonts, the two brackets end up looking like a square, and are hard for people in my courses to read and understand.
🌐
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: ...
🌐
AskPython
askpython.com › home › how to print brackets in python?
How to Print Brackets in Python? - AskPython
May 30, 2023 - That means they are used to specify something. In Python, we use indentation instead of curly braces, but curly braces are still used just not for indentation. They are used for denoting a set or a dictionary.
🌐
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 …
🌐
EnableGeek
enablegeek.com › home › print your (box,curly, parentheses) brackets in python
Print Your (Box,Curly, Parentheses) Brackets in Python - EnableGeek
May 6, 2021 - Here’s an example: ... Note that ... can include parentheses (also known as round brackets) in a string by simply enclosing them within the string....
🌐
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 )).
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Whats-the-difference-between-brackets-braces-and-parentheses
(Brackets) vs {braces} vs [parentheses]: What's the difference?
Parentheses is the proper term for curved or round brackets. Braces is the proper term for curly brackets. Square brackets are simply called brackets. In most programming languages, square brackets are used to define an array: ... The other ...
🌐
Python
docs.python.org › 3.3 › tutorial › datastructures.html
5. Data Structures — Python 3.3.7 documentation
September 19, 2017 - [x, x**2 for x in range(6)] ^ SyntaxError: invalid syntax >>> # flatten a list using a listcomp with two 'for' >>> vec = [[1,2,3], [4,5,6], [7,8,9]] >>> [num for elem in vec for num in elem] [1, 2, 3, 4, 5, 6, 7, 8, 9] List comprehensions can contain complex expressions and nested functions: >>> from math import pi >>> [str(round(pi, i)) for i in range(1, 6)] ['3.1', '3.14', '3.142', '3.1416', '3.14159']
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.

🌐
Reddit
reddit.com › r/learnpython › should i add round brackets to my if statement, if it has more than one condition?
Should I add round brackets to my if statement, if it has more than one condition? : r/learnpython
September 18, 2022 - You don't have to if you're sure you understand the order of operations correctly, but when in doubt ... it can't hurt to add them. Does it still make sense to learn python or any programming language in 2026
🌐
Medium
medium.com › @MamaSita. › python-round-vs-square-brackets-solved-8c3f27735a46
Python; Round VS Square Brackets (SOLVED!) | by MamaSita | Medium
May 29, 2023 - Round brackets for defining class/functions, tuples and performing calculations ... While these are the MAIN uses of both brackets, they are not the ONLY. Be sure to SUBSCRIBE in order to never miss an article! ... Know this and know peace on your python journey!
🌐
Processing
py.processing.org › reference › indexbrackets.html
[] (Index brackets) \ Language (API)
May 12, 2025 - Python Mode for Processing extends the Processing Development Environment with the Python programming language.