From what I can see it's used to create a new set of unique items (correct me if I'm wrong!)

for example:

listA = set(["a", "b", "c"])

listB = set(["b", "c", "d"])

listC = listA.union(listB)

print listC

prints:

# Result:

set(['a', 'c', 'b', 'd'])


see http://docs.python.org/library/stdtypes.html#set

Tom


On 27/04/2012 12:08, Howard Jones wrote:
Out of interest ...
what does 'union' do in this script
Howard

    ------------------------------------------------------------------------
    *From:* Nathan Rusch <[email protected]>
    *To:* [email protected]
    *Sent:* Friday, 27 April 2012, 3:42
    *Subject:* Re: [Nuke-python] Re: selecting a node from its name

    Same function with one line cleaned up (sorry, itâEUR^(TM)s been a
    long day...)
    def recursiveFindReads(node=None, group=nuke.root(), reads=None):
        if reads is None:
            reads = set()
        if node is None:
            node = nuke.selectedNode() # Let this error on purpose if
    no node selected
        for n in node.dependencies(nuke.INPUTS | nuke.HIDDEN_INPUTS):
            cls = n.Class()
            if cls == 'Read':
                reads.add(n)
            elif cls == 'Group':
                reads =
    reads.union(recursiveFindReads(node=nuke.allNodes('Output',
    group=n)[0], group=n, reads=reads))
            else:
                reads = reads.union(recursiveFindReads(node=n,
    group=group, reads=reads))
        return reads
    If you really DO need to select them, just run this:
    nukescripts.clear_selection_recursive()
    [n.setSelected(True) for n in recursiveFindReads()]
    -Nathan

    *From:* invisfx <mailto:[email protected]>
    *Sent:* Thursday, April 26, 2012 7:35 PM
    *To:* [email protected]
    <mailto:[email protected]>
    *Subject:* [Nuke-python] Re: selecting a node from its name
    what I meant by loop is
    depNodes = selectedNode.dependencies()
    only selects the immediate dependencies, not all the way up the
    graph. So I have to re select those nodes and do it again.
    or am I wrong?
    ------------------------------------------------------------------------
    _______________________________________________
    Nuke-python mailing list
    [email protected], http://forums.thefoundry.co.uk/
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

    _______________________________________________
    Nuke-python mailing list
    [email protected]
    <mailto:[email protected]>,
    http://forums.thefoundry.co.uk/
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python




_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to