Passing dict-type arg list to 2nd func??

Bob van der Poel bvdpoel at kootenay.com
Tue Oct 22 02:46:12 CEST 2002


How do I do this?

def woof(v, **k):
	if v==1:
		foo1(k)
	elif v==2:
		foo2(k)
	else:
		foo3(k)


def foo1(**k):
	do something...

etc..

woof(1, bg='red', fg='blue')

I get an error when calling foo1(), etc. Of course, what is happening is
that the keywords are being passed in the format {'bg':'red',
'fg':'blue'}. I have to unpack the dict before passing it???

-- 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bvdpoel at kootenay.com
WWW:   http://www.kootenay.com/~bvdpoel




More information about the Python-list mailing list