Re: Python 2.5: wrong number of arguments given in TypeError forfunction argument aggregation (dictionary input vs the norm)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Mills

    Re: Python 2.5: wrong number of arguments given in TypeError forfunction argument aggregation (dictionary input vs the norm)

    On Fri, Oct 31, 2008 at 9:18 AM, John Krukoff <jkrukoff@ltgc. comwrote:
    Are you sure? It looks like his complaint isn't that it doesn't work,
    but that the error message is misleading.
    >
    With the setup:
    >
    Python 2.5.2 (r252:60911, Sep 22 2008, 12:08:38)
    [GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.
    >>>def foo( a, b, c ):
    ... pass
    ...
    >
    Compare the error messages from:
    >
    >>>foo( **{ 'a' : 1, 'c' : 3 } )
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    TypeError: foo() takes exactly 3 non-keyword arguments (1 given)
    >
    to the error message here:
    >
    >>>foo( **{ 'a' : 1, 'b' : 3 } )
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    TypeError: foo() takes exactly 3 non-keyword arguments (2 given)
    Ahh I see what you mean. Yes ok that is confusing
    and probably a bug :) I missed that. The OPs
    subject was a bit misleading :)

    Python probably indeed is bailing out too early
    in this case.

    --JamesMills

    --
    --
    -- "Problems are solved by method"
Working...