A benchmark shows your suspicions of its performance impact appear to be correct:

$ python -m timeit -s 'd = {"key": "value"}' 'd["key"] = "value"'
10000000 loops, best of 3: 0.0741 usec per loop
$ python -m timeit -s 'd = {"key": "value"}' 'd.update(key="value")'
1000000 loops, best of 3: 0.294 usec per loop
$ python -m timeit -s 'd = {"key": "value"}' 'd.update({"key": "value"})'
1000000 loops, best of 3: 0.461 usec per loop

That is, it's about six times slower on my machine. However, Python is already not a language you'd use if you need top performance, so I'd just recommend use of whatever is most readable in the situation. For many things, that would be the [] way, though update could be more readable in a situation like this:

configuration.update(
    timeout=60,
    host='example.com',
)

…or something like that.

Answer from icktoofay on Stack Overflow
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-dictionary
How to Add and Update Python Dictionaries Easily | DigitalOcean
October 16, 2025 - Assignment operator (=): Best for single item updates and offers the fastest performance · update() method: Most efficient for bulk operations and merging multiple dictionaries · Merge operator (|): Creates new dictionaries without modifying originals (Python 3.9+)
Discussions

dictionary - Why do we need a dict.update() method in python instead of just assigning the values to the corresponding keys? - Stack Overflow
So the reasons to use update() method is either to add a new key-value pair to current dictionary, or update the value of your existing ones. But wait!? Aren't they already possible by just doing: ... More on stackoverflow.com
🌐 stackoverflow.com
Why would I use `dict.update()` in Python instead of assigning values directly? - TestMu AI Community
For example: my_dict = {'1': 11, ... achieve the same effect by directly assigning values: my_dict['1'] = 645 my_dict[5] = 123 This also gives: {'1': 645, '2': 1445, 5: 123} So I’m wondering, in what situations is python dict update crucial or more benefic...... More on community.testmu.ai
🌐 community.testmu.ai
0
December 22, 2025
Why would I use `dict.update()` in Python instead of assigning values directly? - Ask a Question - TestMu AI (formerly LambdaTest) Community
For example: my_dict = {'1': 11, ... achieve the same effect by directly assigning values: my_dict['1'] = 645 my_dict[5] = 123 This also gives: {'1': 645, '2': 1445, 5: 123} So I’m wondering, in what situations is python dict update crucial or more benefic...... More on community.testmuai.com
🌐 community.testmuai.com
0
December 22, 2025
Dictionary Update Method Replaces Instead of Updating
update is replacing your old values because they share the same keys. You can't have multiple different values in a single dict with the same key, so the old values are overwritten. While it makes perfect sense to have a dict for each row, it doesn't make sense to try to store all rows in one dict. Instead, maybe try storing each dict you read into a list of all rows. More on reddit.com
🌐 r/cs50
2
1
April 8, 2022
🌐
Python Guides
pythonguides.com › python-dictionary-update
Python Dictionary Update
January 12, 2026 - To wrap things up, here is a quick look at when to use each Python dictionary update method: .update(): Use this for standard, in-place bulk updates. Direct Assignment: Best for updating or adding a single key-value pair.
🌐
YouTube
youtube.com › watch
python dict update vs assign - YouTube
Download this code from https://codegive.com Dictionaries in Python are versatile data structures that allow you to store and manipulate key-value pairs. Two...
Published   January 21, 2024
🌐
Python
peps.python.org › pep-0584
PEP 584 – Add Union Operators To dict | peps.python.org
Update a dict in place: The Obvious Way is to use the update() method. If this proposal is accepted, the |= augmented assignment operator will also work, but that is a side-effect of how augmented assignments are defined.
Find elsewhere
🌐
TestMu AI
community.testmu.ai › ask a question
Why would I use `dict.update()` in Python instead of assigning values directly? - TestMu AI Community
December 22, 2025 - I understand that the update() method on dictionaries in Python can be used to add new key-value pairs or update existing ones. For example: my_dict = {'1': 11, '2': 1445} my_dict.update({'1': 645, 5: 123}) This will r…
🌐
Data Science Parichay
datascienceparichay.com › home › blog › python add or update item in dictionary
Python Add or Update Item in Dictionary - Data Science Parichay
October 4, 2020 - In this tutorial, we’ll look at how you can add or update items in a dictionary. Before we proceed, here’s a quick refresher on dictionaries in python – Dictionaries are a collection of items used for storing key to value mappings. They are mutable and hence we can update the dictionary by adding new key-value pairs, removing existing key-value pairs, or changing the value corresponding to a key.
🌐
Reddit
reddit.com › r/cs50 › dictionary update method replaces instead of updating
r/cs50 on Reddit: Dictionary Update Method Replaces Instead of Updating
April 8, 2022 -

I've completed DNA and submitted for full credit using lists instead of dictionaries. DNA was really enthralling to me for some reason and I'm going back and trying to make my code both more pythonic and attempting to get it better optimized. Part of my motivation is that I just don't feel anywhere near as comfortable with dictionaries as I did coming out of previous weeks' psets that had similar, heavier (for me) concepts.

One specific area that's giving me trouble in my understanding is the .update() method. I'm using it to store the small.csv info into a dict named STR. I had thought it was the analogue of .append() for lists but, after trying to incorporate it into my revamped DNA, it will update for the first row of the CSV being read on the first iteration but then it just continually replaces that single row/entry in the dict with each iteration. I'm sure I'm just not grasping something fundamental about dicts and/or update() but am not knowledgeable enough yet to know what that might be. I'm not even sure it's technically necessary to be storing the database csv or if it's better to work with the CSV in-place.

Could someone please help me understand why my expectation of update() is flawed?

The code below only stores the last line of the small.csv database:

{'name': 'Charlie', 'AGATC': '3', 'AATG': '2', 'TATC': '5'}

    # Open person STR profiles csv and append to STR list

    with open(sys.argv[1], 'r', newline = '') as file:
        reader = csv.DictReader(file)
        for row in reader:
            STR.update(row)
🌐
Note.nkmk.me
note.nkmk.me › home › python
Add and Update an Item in a Dictionary in Python | note.nkmk.me
August 25, 2023 - In this case, keys must be valid identifiers in Python. They cannot start with a number or contain symbols other than _. ... # d.update(k-3=3) # SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
🌐
GeeksforGeeks
geeksforgeeks.org › python-update-dictionary-with-other-dictionary
Update Dictionary with other Dictionary - Python - GeeksforGeeks
January 27, 2025 - Update a Dictionary in PythonBelow, are the approaches to Update a Dictionary in Python: Using with Direct assignmentUs
🌐
Reddit
reddit.com › r/learnpython › python dictionary update - is this right approach?
r/learnpython on Reddit: Python Dictionary update - is this right approach?
July 3, 2024 -

Hallo Team,

I want to update a json file which no less than 100 values.

Here is short example, I wish to update the values in this json file

{
    "skipEsxThumbprintValidation": true,
    "managementPoolName": "pool-md-vcf0-ko",
    "sddcManagerSpec": {
        "hostname": "sddc-md-vcf0-ko",
        "ipAddress": "172.16.18.59",
        "netmask": "255.255.255.0",
        "localUserPassword": "YouknowBetter!",
        "rootUserCredentials": {
            "username": "root",
            "password": "YouknowBetter!"
        },
        "secondUserCredentials": {
            "username": "vcf",
            "password": "YouknowBetter!"
        }
    },

my code looks like below

# Purpose: read the json template and create a new bringup file out of it
import json

bringup_template = "vcf51_bring_template.json"
with open(bringup_template, "r") as f:
    template_data = json.load(f)
sddcspecs = template_data.get("sddcManagerSpec")

sddcspecs["hostname"] = "test"
sddcspecs["ipAddress"] = "someip"
sddcspecs["netmask"] = "somedata"
sddcspecs["localUserPassword"] = "something"
sddcspecs["rootUserCredentials"] = "something"
sddcspecs["secondUserCredentials"] = "something"
template_data.update(sddcspecs)
print(template_data)

I was wondering if there is better approach to update this dictionary. The above is a very small snippet of json file. I have minimum 100 values to update. I see this is literally typing all things without much logic.

Is there a better approach?

🌐
GeeksforGeeks
geeksforgeeks.org › python-dictionary-update-method
Python Dictionary update() method - GeeksforGeeks
December 9, 2024 - Python Dictionary update() method updates the dictionary with the elements from another dictionary object or from an iterable of key/value pairs.
🌐
Quora
quora.com › How-do-I-update-key-and-value-in-dictionary-in-python
How to update key and value in dictionary in python - Quora
Use direct assignment or update for simple value changes. Use pop+assign or construct a new dict when renaming keys. Use comprehensions for bulk or conditional transforms. Examples above work in CPython and reflect Python semantics as of May 2024.
🌐
Real Python
realpython.com › python-dicts
Dictionaries in Python – Real Python
April 8, 2026 - You can populate your dictionaries manually with new key-value pairs by assigning values to new keys. Internally, Python will create the key-value pair for you. Keep in mind that keys are unique.
🌐
Programiz
programiz.com › python-programming › methods › dictionary › update
Python Dictionary update()
The update() method updates the dictionary with the elements from another dictionary object or from an iterable of key/value pairs.
🌐
PyTutorial
pytutorial.com › python-dict-update-method-guide-examples
PyTutorial | Python Dict Update Method Guide & Examples
January 27, 2026 - It's important to know when to use it versus other methods. Use update() for bulk modifications from another mapping. Use simple assignment (dict['key'] = value) for changing a single known key.