You want to pass a value of 1 for each attr in the list as a key? You can convert it to a dict and then use unpacking
kw = dict((a, 1) for a in attrs) pm.polyExtrudeFacet(extrusion, q=1, **kw) On 16/10/2014 9:12 PM, "Sam555" <[email protected]> wrote: > Hello guys, > > I'm learning python and stumble upon some simple things. > is there a way to use a list to feed the flags of a maya command ? > > i have a very long list of attributes that i want to send in a list > comprehension, something like this: (i've shortened the list for > demonstration) > > attrs=["constructionHistory", "gravity", "gravityY", "gravityZ", > "nodeState", "offset", "pivot"] > > for attr in attrs : > attributesList=[pm.polyExtrudeFacet(extrusion, attr=1", q=1) for > attr in attrs] > > This code doesn't work as expected because "attr" is not recognize as a > variable in the flags. > How would you do that ? > > Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/c846f255-057e-4c39-ad35-f60f23c899ca%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/c846f255-057e-4c39-ad35-f60f23c899ca%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA200%2BTHo4%3D24m7q9qLCObtYdUf2VMB1aaHNF29n_6nZtw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
