passing keyword args as a parameter

max(01)* max2 at fisso.casa
Tue Mar 29 12:36:40 CEST 2005


hi there!

this post is somewhat a generalization of one previous question.

i was wondering if it is possible to pass an argument list as a
parameter to a function. example:

def fun_con_pc(pc1 = "Ciao!", pc2 = 42):
   print pc1
   print pc2

fun_con_pc()
fun_con_pc(pc1 = "Addio...")

fun_con_pc(pc2 = 666, pc1 = "Addio...")

arg = 'pc2 = 666, pc1 = "Addio..."'
fun_con_pc(arg)

....

if i execute, i get:

Ciao!
42
Addio...
42
Addio...
666
pc2 = 666, pc1 = "Addio..."
42

**but** i want to get:

Ciao!
42
Addio...
42
Addio...
666
Addio...
666

....

see what i mean?

bye

macs



More information about the Python-list mailing list