Apr-13-2023, 10:25 PM
for a reference to a list, such as a global list, i can replace all the contents like this:
mylist[:] = newlistfor a reference to a dict. such as a global dict, i can replace certain contents like this:
mydict.update(newdict)but this is not a total replacement. keys in the referenced dict that are not in the new dist will remain in the referenced dict with their original value(s). it is possible to do a full content replacement by clearing the dict before the update:
mydict.clear() mydict.update(newdict)or by name assignment:
global mydict . . . mydict = newdictmy question is: is there a way to completely replace the dict contents, from another dict, in one single operation as can be done with a list?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.