On Saturday, October 25, 2014 at 2:09:22 AM UTC+2, Michael DeHaan wrote:
>
> I think your filter plugin could be more easily written:
>
> hash_a.update(hash_b)
>
> perhaps?
>
> If you send in a pull request, this seems reasonable to have as a core 
> filter.
>
> I'd probably call it 'update' if I'm correct on the above, which I think I 
> am.  If not, perhaps "merge".
>
>>
>>
I had exactly the same idea. Did anybody do a PR for this? I don't see it 
in 1.9 nor in devel.

If nobody else has time for it I could do it. I think this is really a gap. 
Anyway this way is definitely more what they call *pythonic* than tweaking 
the union filter. 

My code  is simply:

def update(dic, odic):
    dic.update(odic)
    return dic


class FilterModule(object):

    def filters(self):
        return {

            'update': update,
            'update_dict': update,
            'merge_dict': update
        }



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/19a0eb26-c285-462a-8beb-9983b1733b86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to