1 | initial version |
I cannot imagine the reason for doing this, but if the dynamic number of variables is somehow bounded in the application, then an adaptation of the following may work (in a way that i do not really like, since generally explicit is better than implicit...)
sage: def vars(n): return eval( "','.join( 'x%%s'%%j for j in range(1,%s) )" % (n+1) )
sage: var( vars(9) )
(x1, x2, x3, x4, x5, x6, x7, x8, x9)
sage: eval( "function('yyy')( %s )" % vars(9) )
yyy(x1, x2, x3, x4, x5, x6, x7, x8, x9)
sage: eval( "function('yyy')( %s )" % vars(4) )
yyy(x1, x2, x3, x4)
(For an explicit special meaningful situation, i would rethink, and very probably go on a different path...)