It’s using a list comprehension 
(http://docs.python.org/tutorial/datastructures.html#list-comprehensions).

The expression technically returns a list, but we don’t care about it, and it 
just contains the results of all the .setValue calls (probably [True, True, 
..., True]).

Here it is in expanded form:

for s in nuke.allNodes('Switch', nuke.root()):
    if s.name().startswith('switchEngFre'):
        s['which'].setValue(1)

-Nathan



From: kylesim 
Sent: Wednesday, November 02, 2011 7:46 AM
To: [email protected] 
Subject: [Nuke-python] Re: nuke.toNode question

Thanks Nathan - that works perfectly! So that I fully understand the code could 
you give me a simple explanation?
Thanks,
-Kyle


--------------------------------------------------------------------------------
_______________________________________________
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