Python Forum
updating certain values in dict. with relation to their keys
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
updating certain values in dict. with relation to their keys
#17
@buran with regards to runtime considerations your solution is not optimal.
Searching through spam.values() is slower than through a normal list
In worst case, if value is last item in spam.values() you iterate twice over all items in dictionary.
Using my code you iterate only once even in worst case.
Reply


Messages In This Thread
RE: updating certain values in dict. with relation to their keys - by ThomasL - Nov-27-2019, 02:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Chain object that have parent child relation.. SpongeB0B 10 1,274 Dec-12-2023, 01:01 PM
Last Post: Gribouillis
  logging values from constantly updating CLI app imvirgo 1 588 Sep-27-2023, 05:01 PM
Last Post: deanhystad
  Updating Code And Having Issue With Keys Xileron 8 1,353 May-25-2023, 11:14 PM
Last Post: DigiGod
  dict class override: how access parent values? Andrey 1 1,721 Mar-06-2022, 10:49 PM
Last Post: deanhystad
  Updating nested dict list keys tbaror 2 1,348 Feb-09-2022, 09:37 AM
Last Post: tbaror
  Loop Dict with inconsistent Keys Personne 1 1,671 Feb-05-2022, 03:19 AM
Last Post: Larz60+
  Removing nan values from a dict tomtom 8 7,429 Oct-05-2021, 06:44 PM
Last Post: tomtom
  Create Dict from multiple Lists with duplicate Keys rhat398 10 4,215 Jun-26-2021, 11:12 AM
Last Post: Larz60+
  Values not updating for restful call boomramada 0 1,700 Mar-13-2021, 01:08 PM
Last Post: boomramada
  Adding keys and values to a dictionary giladal 3 2,610 Nov-19-2020, 04:58 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020