Prepackaged function args

B

boblatest

Hello group,

suppose I've got a function f() that takes N parameters, and a list
(or tuple) arg[] with N elements that I'd like to pass as parameters.
The straightforward function call looks like this:

result = f(arg[0], arg[1], ..., arg[N-1])

Is there a less verbose way of accomlishing this?

Thanks,
robert
 
C

Chris Rebert

Hello group,

suppose I've got a function f() that takes N parameters, and a list
(or tuple) arg[] with N elements that I'd like to pass as parameters.
The straightforward function call looks like this:

result = f(arg[0], arg[1], ..., arg[N-1])

result = f(*arg)

Cheers,
Chris
 
J

John O'Hagan

Hello group,

suppose I've got a function f() that takes N parameters, and a list
(or tuple) arg[] with N elements that I'd like to pass as parameters.
The straightforward function call looks like this:

result = f(arg[0], arg[1], ..., arg[N-1])

Is there a less verbose way of accomlishing this?
[...]

result = f(*arg)

Regards,

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,291
Messages
2,571,453
Members
48,132
Latest member
AnneHarpur

Latest Threads

Top