Creating dynamic objects with | separator python
Question: What I want is to solve is something like this

    
    
    names = ['Aleister', 'Matovu']
    args = (Q(name__contains=name[0])|Q(name__contains=name[1]))
    queryset.complex_filter(args)
    

What the problem is I have a names as a dynamic object and its length is not
fixed. What I am thinking would work is if I looped though the names and
created a dynamic `args` object but I am not sure what kind of object that is.
I am not sure how exactly to do that, so I am stuck.

If you can help around that, that will be really cool or if you can give me an
alternative way to go about the same scenario that would be awesome. Thank you


Answer: 
    import operator
    names = [...]
    query = reduce(operator.or_, [Q(name__icontains=name) for name in names])
    results = queryset.complex_filter(query)
    

