> I mean, I can of course do f(P1[0],P1[1],P1[2]),
> but this is highly non-elegant.

You can use an asterisk:

sage: f(x,y,z) = x+10*y+100*z
sage: P1 = [2,3,4]
sage: f(*P1)
432

Here, * behaves kind of like a dereferencing operator: f(*(x,y,z)) ==
f(x,y,z).  See this StackOverflow question for a longer explanation:

http://stackoverflow.com/questions/2921847/python-once-and-for-all-what-does-the-star-operator-mean-in-python


Doug

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to