Douglas Garstang writes:
> where line 42 is 'assert type(default(k))==dict', and the inputs are:
Woops, cut and paste error. default(k) should say default[k]. Or you
could remove the assertion altogether.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Aug 2, 2010 at 1:09 AM, Peter Otten <__pete...@web.de> wrote:
> Douglas Garstang wrote:
>
>> I have the two dictionaries below. How can I merge them, such that:
>>
>> 1. The cluster dictionary contains the additional elements from the
>> default dictionary.
>> 2. Nothing is removed from the
Douglas Garstang wrote:
> On Mon, Aug 2, 2010 at 12:47 AM, Paul Rubin
wrote:
>> If yes, then the following works for me:
>>
>>def merge(cluster, default):
>># destructively merge default into cluster
>>for k,v in cluster.iteritems():
>>if k in default and type(v)
On Mon, Aug 2, 2010 at 12:47 AM, Paul Rubin wrote:
> Douglas Garstang writes:
>> default = {...
>> 'data_sources': { ...
>> cluster = {...
>> 'data_source': { ...
>
> Did you want both of those to say the same thing instead of one
> of them being 'data_source' and
Douglas Garstang wrote:
> I have the two dictionaries below. How can I merge them, such that:
>
> 1. The cluster dictionary contains the additional elements from the
> default dictionary.
> 2. Nothing is removed from the cluster dictionary.
def inplace_merge(default, cluster):
assert isinsta
Douglas Garstang writes:
> default = {...
> 'data_sources': { ...
> cluster = {...
> 'data_source': { ...
Did you want both of those to say the same thing instead of one
of them being 'data_source' and the other 'data_sources' ?
If yes, then the following works fo
On Mon, Aug 2, 2010 at 12:06 AM, Douglas Garstang
wrote:
> Actually, I had issues with trying recurse through the structures in
> tandem too. This didn't work:
>
> for a,b,c,d in ( cluster.iteritems(), default.iteritems() ):
> ... do something ...
>
> It returns an unpack error.
Well, yeah. Th
On Sun, Aug 1, 2010 at 11:57 PM, Gary Herron wrote:
> On 08/01/2010 11:11 PM, Douglas Garstang wrote:
>>
>> On Sun, Aug 1, 2010 at 10:58 PM, Gary Herron
>> wrote:
>>
>>>
>>> On 08/01/2010 10:09 PM, Douglas Garstang wrote:
>>>
Anyone,
I have the two dictionaries below. How can
On 08/01/2010 11:11 PM, Douglas Garstang wrote:
On Sun, Aug 1, 2010 at 10:58 PM, Gary Herron wrote:
On 08/01/2010 10:09 PM, Douglas Garstang wrote:
Anyone,
I have the two dictionaries below. How can I merge them, such that:
1. The cluster dictionary contains the additional elements
Anyone,
I have the two dictionaries below. How can I merge them, such that:
1. The cluster dictionary contains the additional elements from the
default dictionary.
2. Nothing is removed from the cluster dictionary.
The idea here is that the two dictionaries are read from different
files where, i
10 matches
Mail list logo