How to create an empty tuple in Python?

Tuple is one of the data structures of the Python programming language. It is used to store multiple values separated by commas in an ordered manner.

It is immutable in the sense that once the tuple is created you cannot perform any operations like deleting, appending, etc. The elements in the tuple can be int, float, string, or binary data types, and it allows duplicates of the elements. It uses indexing for accessing the elements.

There are different ways to create an empty tuple. Let's see each method in detail.

  • Using empty parentheses ()

  • Using tuple() constructor

Method 1: Using Empty Parentheses

The simplest way to create an empty tuple is using empty parentheses ().

Syntax

variable_name = ()

Where,

  • variable_name is the name of the tuple

  • () are empty parentheses for creating the empty tuple

Example

When we assign empty parentheses () to a variable, an empty tuple will be created ?

empty_tuple = ()
print("Empty tuple created using parentheses:", empty_tuple)
print("Type:", type(empty_tuple))
print("Length:", len(empty_tuple))

The output of the above code is ?

Empty tuple created using parentheses: ()
Type: <class 'tuple'>
Length: 0

Demonstrating Immutability

Since tuples are immutable, attempting to modify an empty tuple will raise an error ?

empty_tuple = ()
print("Empty tuple:", empty_tuple)

# This will raise an error
try:
    empty_tuple[0] = 10
except TypeError as e:
    print("Error:", e)

The output shows the immutability of tuples ?

Empty tuple: ()
Error: 'tuple' object does not support item assignment

Method 2: Using tuple() Constructor

The empty tuple can be created using the tuple() constructor function available in Python.

Syntax

variable_name = tuple()

Where,

  • variable_name is the name of the tuple

  • tuple() is the constructor function for creating an empty tuple

Example

When we call the tuple() constructor without arguments, an empty tuple will be created ?

empty_tuple = tuple()
print("Empty tuple created using constructor:", empty_tuple)
print("Type:", type(empty_tuple))
print("Length:", len(empty_tuple))

The output of the above code is ?

Empty tuple created using constructor: ()
Type: <class 'tuple'>
Length: 0

Comparison of Both Methods

Method Syntax Readability Performance
Empty Parentheses () High Faster
tuple() Constructor tuple() High Slightly slower

Common Use Cases

Empty tuples are useful for initialization before adding data or as default values ?

# Initialize an empty tuple
coordinates = ()
print("Initial coordinates:", coordinates)

# Create a new tuple with data (since tuples are immutable)
coordinates = (10, 20)
print("Updated coordinates:", coordinates)

# Using as default parameter
def process_data(data_tuple=()):
    if not data_tuple:
        print("No data provided, using empty tuple")
    else:
        print("Processing:", data_tuple)

process_data()
process_data((1, 2, 3))

The output demonstrates practical usage ?

Initial coordinates: ()
Updated coordinates: (10, 20)
No data provided, using empty tuple
Processing: (1, 2, 3)

Conclusion

Both () and tuple() create empty tuples effectively. Use () for better readability and performance. Remember that tuples are immutable, so you cannot modify them after creation.

Updated on: 2026-03-24T20:06:22+05:30

9K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements