Difference between default arguments and keyword arguments

Marco Herrn herrn at gmx.net
Sun Apr 4 10:04:29 EDT 2004


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


Is it because the other arguments are optional? The function is defined
as follows:

    __import__( name[, globals[, locals[, fromlist]]])

Marco
-- 
Marco Herrn             herrn at gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736




More information about the Python-list mailing list