Difference between default arguments and keyword arguments

Paul Prescod paul at prescod.net
Sun Apr 4 14:00:54 EDT 2004


Marco Herrn wrote:

> On 2004-04-04, DoubleM <DoublemPI at netscape.net> wrote:
> 
>>All arguments are keyword arguments.  They may or may not have a default 
>>value.  In your example, voltage is a keyword argument, but it has no 
>>default.
> 
> 
> But what does this mean?:
> 
>     >>> __import__(name="eggs")
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>     TypeError: __import__() takes no keyword arguments

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.

  Paul Prescod






More information about the Python-list mailing list