
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How expensive are Python dictionaries to handle?
dicts in python are heavily optimized. Creating a dict from N keys or key/value pairs is O(N), fetching is O(1), putting is amortized O(1), and so forth. You dont need to optimize them explicitly. You can be sure of this as python under the hood implements its own classes using dicts.
Don't compare lists/tuples to dicts/sets though as they solve different problems.
- Related Articles
- How are dictionaries implemented in Python?
- How to merge multiple Python dictionaries?
- What are Ordered dictionaries in Python?
- How to create Ordered dictionaries in Python?
- How to perform Calculations with Dictionaries in Python?
- Python program to merge to dictionaries.
- Python program to merge two Dictionaries
- How can we merge two Python dictionaries?
- How to handle an exception in Python?
- How to handle Python exception in Threads?
- How to merge two Python dictionaries in a single expression?
- How do we compare two dictionaries in Python?
- How to handle python exception inside if statement?
- How to handle very large numbers in Python?
- How to handle frames in Selenium with python?

Advertisements