Using assingment as an operator.

Steve Holden sholden at
Fri Oct 12 15:23:20 CEST 2001

"Emil S. Hansen" <esh at> wrote ...
> Hello fellow PP.
> I have a simple question. In a program I have a statement like this:
> while"[^a-z0-9.]", domainname = raw_input("Please enter
domainname: ")) != None:
>         print "Error in domainname, please use lovercase letters and
numbers only."
> When I run the program I get a
> "TypeError: unexpected keyword argument: domainname",
> how can I use an assigment as an operator for a function?

You can't. See Frequently Asked Question 6.30 for why. The syntax you use is
for keyword arguments to functions, another subject entirely.

def f(a):
    return a*a

can be called using


and you can explicity declare an argument as a keyword argument with a
default value. I only mention all this to explain the apprently bizarre
error message.


More information about the Python-list mailing list