DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk1 min

Create an Empty Dictionary in Python: {} vs. dict()

Both {} and dict() create a fresh, empty Python dictionary. Use set() for an empty set; {} means an empty dictionary.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use either {} or dict() to create a new, empty Python dictionary. The first is dictionary display syntax; the second calls the built-in dict constructor with no arguments. Both produce separate, mutable dictionary objects.

How to create an empty dictionary

Assign either expression to a variable:

by_literal = {}
by_constructor = dict()

print(type(by_literal))                    # <class 'dict'>
print(by_literal == by_constructor)        # True
print(by_literal is by_constructor)        # False

The equality check is true because both dictionaries contain the same entries—none. The identity check is false because each expression creates a new object.

What is the difference between {} and dict()?

Expression What it does When it fits
{} Creates a dictionary using dictionary display syntax. The Python language reference describes a dictionary display as “a possibly empty series of dict items enclosed in curly braces.” Python language reference A concise, direct way to write an empty dictionary.
dict() Calls the built-in dictionary constructor without arguments, which returns a new empty dictionary. Python 3.14.7 built-in types documentation Useful when the surrounding code uses dict to build dictionaries from mappings, iterables, or keyword arguments.

For example, dict() can initialize from pairs as well as create an empty dictionary:

empty = {}
from_pairs = dict([("language", "Python"), ("version", 3)])

For an empty dictionary alone, either form is correct. The official documentation describes both forms but does not establish a mandatory style preference or a speed ranking for this choice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why {} does not make an empty set

In Python, empty braces mean an empty dictionary, not an empty set. Use set() when you need an empty set. Python tutorial: Data Structures

empty_dict = {}
empty_set = set()

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.