[Python-Dev] dict.supplement() (was Re: list.shift())

Ka-Ping Yee ping@lfw.org
Sat, 18 Mar 2000 10:48:10 -0800 (PST)


On Fri, 17 Mar 2000 artcom0!pf@artcom-gmbh.de wrote:
> 
> I think no.  But what about this one?:
> 
> 	# pretend self and dict are dictionaries:
> 	def supplement(self, dict):
> 	    for k, v in dict.items():
> 	        if not self.data.has_key(k):
> 		    self.data[k] = v

I'd go for that.  It would be nice to have a non-overwriting update().
The only issue is the choice of verb; "supplement" sounds pretty
reasonable to me.


-- ?!ng

"If I have not seen as far as others, it is because giants were standing
on my shoulders."
    -- Hal Abelson