Re: Python function with **kwargs Question

2006-01-06 Thread Duncan Booth
Eric McGraw wrote: > You could call it like this: foo(**{"a-special-keyword":5}) > but that might defeat the purpose of keyword arguments. > Don't forget you can mix ordinary keyword arguments with the ** call, so only the weird arguments actually need to be passed that way. >>> def f(**ar

Re: Python function with **kwargs Question

2006-01-06 Thread Eric McGraw
You could call it like this: >>> foo(**{"a-special-keyword":5}) but that might defeat the purpose of keyword arguments. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python function with **kwargs Question

2006-01-05 Thread Christian Tismer
Hi Fletch, ... >>> How do I tell Python to treat '-' as a normal character but not part >>> of an expression? >>> >> >> By changing the parser :-) >> >> > Oh, you py-py guys, always thinking you have to re-implement Python ;) Well, in the given context, assuming keywords are supposed to be

Re: Python function with **kwargs Question

2006-01-05 Thread Khoa Nguyen
Thanks for your responses. I guess the foo(**{'x-y':3}) is ugly but will do the trick Cheers,Khoa On 1/5/06, Mike C. Fletcher < [EMAIL PROTECTED]> wrote:Christian Tismer wrote:>Khoa Nguyen wrote: I would like to pass some keyword with special character to a>>foo(**kwargs) function, but it doesn

Re: Python function with **kwargs Question

2006-01-05 Thread Christian Tismer
Khoa Nguyen wrote: > I would like to pass some keyword with special character to a > foo(**kwargs) function, but it doesn't work > > def foo(**kwargs): > print kwargs > > > This doesn't work: > > foo(a-special-keyword=5) > > How do I tell Python to treat '-' as a normal character but not pa

Python function with **kwargs Question

2006-01-05 Thread Khoa Nguyen
I would like to pass some keyword with special character to a foo(**kwargs) function, but it doesn't workdef foo(**kwargs):  print kwargsThis doesn't work:foo(a-special-keyword=5)How do I tell Python to treat '-' as a normal character but not part of an _expression_? Thanks,Khoa -- http://mail.py