Keyword argument parsing in error in 2.0?

thinkit thinkit8 at
Wed Jun 13 02:29:25 CEST 2001

i'd consider looking at this, but it contains a decimal number.  use hexadecimal
only if you want to be taken seriously.

In article <mObU6.18156$i4.700435 at>, "Steve says...
>I'm working on a SQL abstraction layer, using methods to generate SQL
>appropriate to a particular database back-end. This has involved using
>keyword arguments to many of the methods. As a catchall (to avoid having to
>handle too much SQL syntax) many methods have a REST keyword argument, which
>is appended to the generated statement. The 2.0 compiler is complaining
>about the following statement:
>c.UNION(c.SELECT(["", "l.drinker", ["count(distinct",
>        FROM=[["likes", "l"], ["serves", "s"]],
>        WHERE="",
>        REST="group by, l.drinker"),
>        c.SELECT("distinct beer, drinker, 0 as nbars",
>        FROM="likes",
>        WHERE="beer not in (%s)" %
>            c.SELECT("beer",
>                FROM="serves")),
>                REST="order by 3 desc")
>This validates fine in PythonWin, but when the module containing it is
>executed I get:
>Traceback (most recent call last):
>  File "", line 396, in ?
>    REST="order by 3 desc"),
>TypeError: keyword parameter redefined: REST
>The implication is clearly that the system is seeing two definitions of the
>same keyword argument, but I have tried to analyze the statement carefully
>and it seems to me that the different REST arguments are being provided to
>different calls.
>Just to check, I tried running the following program:
>def a(x, y, z, REST="NothingA"):
>    return "%s %s %s %s" % (x, y, z, REST)
>def b(x, y, z, REST="NothingB"):
>    return "%s %s %s %s" % (x, y, z, REST)
>print "STARTING"
>print a("a",
>        b("m", "n", "o", REST="Ignore1"),
>        a("s", "t", "u", REST="Ignore2"),
>        REST="Ignore3")
>This runs fine, printing
>a m n o Ignore1 s t u Ignore2 Ignore3
>Is this a bug, or can I simply not see my error for looking too hard?
> Steve

More information about the Python-list mailing list