newbie dictionary question

Grant Edwards grante at visi.com
Sun Apr 21 21:30:47 EDT 2002


In article <g1Jw8.89176$G72.64386 at sccrnsc01>, James Chapman wrote:
> Hi,
> 
> I'd preferably like to use something like this but my problem
> is precisely this. I have for example to dictionaries as
> follows:
> 
> a= {4.95:100,4.97:90,4.99:95}
> b={4.95:100,4.96:99}
> 
> and I would wonder if there is an elegent way to do something like:
> 
> c = a+b
> c={4.95:200,4.96:99,4.97:90,4.99:95}

c={}
c.update(a)
c.update(b)

Though I can pretty much guarantee that using floats as
dictionary keys isn't going to do what you want at some point.

-- 
Grant Edwards                   grante             Yow!  I'd like some JUNK
                                  at               FOOD... and then I want to
                               visi.com            be ALONE --



More information about the Python-list mailing list