Python Forum
Merging Dictionaries - Optimum Style?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merging Dictionaries - Optimum Style?
#4
(Oct-09-2019, 07:07 AM)buran Wrote: clearly, star unpacking is faster

Thanks for your kind confirmation along with the speed test. It is nice to know that star unpacking, apart from being the simplest, is faster too.

As rightly pointed out by you, the function works smoothly without qualifying self with class name.

(Oct-09-2019, 07:24 AM)perfringo Wrote: if there are same keys in dictionaries to be merged they will be overwritten without warning and only the last will remain.

Thanks for your kind input. In such a situation, if straight overwriting can't be permitted, custom function might be needed as star unpacking as well as update get ruled out.
A.D.Tejpal
Reply


Messages In This Thread
Merging Dictionaries - Optimum Style? - by adt - Oct-09-2019, 06:45 AM
RE: Merging Dictionaries - Optimum Style? - by adt - Oct-09-2019, 08:09 AM
RE: Merging Dictionaries - Optimum Style? - by adt - Oct-09-2019, 05:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  optimum chess endgame with D=3 pieces doesn't give an exact moves_to_mate variable max22 1 394 Mar-21-2024, 09:31 PM
Last Post: max22
  merging three dictionaries Skaperen 3 2,105 Oct-20-2020, 10:06 PM
Last Post: Skaperen
  merging dictionaries Skaperen 3 2,653 Nov-13-2018, 06:26 AM
Last Post: Skaperen
  merging two dictionaries Skaperen 17 11,233 Oct-05-2017, 12:47 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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