passing *args "recursively"

G

Guillermo

Hi,

This must be very basic, but how'd you pass the same *args several
levels deep?


def func2(*args)

print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?

def func1(*args):

print args # (1, 2, 3)
func2(args)

func1(1,2,3)

Thanks!

Guillermo
 
M

Matimus

Hi,

This must be very basic, but how'd you pass the same *args several
levels deep?

def func2(*args)

print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?

def func1(*args):

print args # (1, 2, 3)
func2(args)

func1(1,2,3)

Thanks!

Guillermo

def func1(*args):
print args
func2(*args) # don't forget the '*'

Matt
 
G

Gary Duzan

Hi,

This must be very basic, but how'd you pass the same *args several
levels deep?


def func2(*args)

print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?

def func1(*args):

print args # (1, 2, 3)
func2(args)
func2(*args) # <<<<<<======
func1(1,2,3)

Gary Duzan
Motorola H&NM
 
M

Mikael Olofsson

Guillermo said:
This must be very basic, but how'd you pass the same *args several
levels deep?

def func2(*args)
print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?

def func1(*args):
print args # (1, 2, 3)
func2(args)

func1(1,2,3)

Me said:

That was a bit unclear. You should use func2(*args) when you call the
function.

/MiO
 

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

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,947
Members
47,498
Latest member
log5Sshell/alfa5

Latest Threads

Top