Difference between default arguments and keyword arguments

Aahz aahz at pythoncraft.com
Mon Apr 5 00:42:19 EDT 2004


In article <mailman.330.1081101671.20120.python-list at python.org>,
Paul Prescod  <paul at prescod.net> wrote:
>
>Functions implemented in C do not always have the property that every 
>argument is a keyword argument. Functions implemented in Python do have 
>that property. It's an implementation quirk.

Really?

    def foo(*args):
        pass

    foo(x=1)

Traceback (most recent call last):
  File "x.py", line 4, in ?
    foo(x=1)
TypeError: foo() got an unexpected keyword argument 'x'
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"usenet imitates usenet"  --Darkhawk



More information about the Python-list mailing list