but i'm still wondering what is exectly going on.
Ha ok let me explain, all python code passing happens via lists and dictionaries, so all python fnctions get 2 things inputted a list and a dictionary.
when you make a function:
def function(foo,bar):
pass
you give in a list with 2 members where the first will be put in foo, and second into bar.
when you do:
def function2(alpha=foo,beta=bar):
pass
you are asking for the dictionary, tough granted called without names python poulates the first ones of the list in order UNLESS theres a corresponding dictionary item. now all python fuctions can be called in following way:
function3(item,item,dict=dictitem, other=dictitem)
Well thats fun but what if i allready have a list and a dictionary. Well just slap them in
list=[item,item]
dict={'dict':dictitem, 'other':dictitem}
function3(*list,**dict)
well what if i have a list AND a items well you ca mix and match:
list=[item]
dict={'other':dictitem}
function3(item,dict=dictitem,*list,**dict)
this si the same as all above the item just gets pushed first into the passed list. Theres just a rule that states. In what order functions must pass things:
first must come unnamed items
then any named items that are not to be filled by unnamed ones
then any list thet needs to expand
then any dictionary that needs to expand
I think this makes it hard to udnerstand becase the *llist is actually comming as if written AFTER the first item in normal syntax.
so you could also write :
cmd.setAttr(objectName+'.stringArray',len(sArray),type = "stringArray", *sArray)
as
list=[objectName+'.stringArray',len(sArray)]
list.extend(sArray)
dict={'type': 'stringArray'}
cmd.setAttr(*list,**dict)
or simply:
cmd.setAttr(*[objectName+'.stringArray',len(sArray)]+sArray,**{'type':'stringArray'})
just that the first is syntaxically the easiest to write and has less visible operations. Thus least likely to err and easiest to maintain- Thus what you should use.