Sunday, February 3, 2013

Container Types

1) Sequences: nums = [1,2,3,3,5,6,7,7,7,8,9] (could exists same number)
2) Sets: numset = set(nums) = [1,2,3,5,6,7,8,9] (pruned duplicate elements, more efficient)
             While you can generate a set from a list, a list cannot be an item in a set!
3) Dictionaries: numberNames = {1:'one', 2:'two', 3:'three', 'one':1, 'two':2, 'three':3};
    (Mutable object, hashable. The keys do not all need to be the same type, the up dictionary mapped numbers to names, as well as names to numbers.)

Practice:
import maya.cmds;
loc = maya.cmds.spaceLocator()[0];
print(maya.cmds.xform(loc, q=True, rotateOrder=True));
RESULT:xyz

1 comment: