[Python-Dev] dict.supplement() (was Re: list.shift())
Fred L. Drake, Jr.
fdrake@acm.org
Mon, 20 Mar 2000 11:55:59 -0500 (EST)
artcom0!pf@artcom-gmbh.de writes:
> Note the similarities to {}.update(dict), but update replaces existing
> entries in self, which is sometimes not desired. I know, that supplement
> can also simulated with:
Peter,
I like this!
> tmp = dict.copy()
> tmp.update(self)
> self.data = d
I presume you mean "self.data = tmp"; "self.data.update(tmp)" would
be just a little more robust, at the cost of an additional update.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
Corporation for National Research Initiatives