Keyword argument parsing in error in 2.0?
Steve Holden
sholden at holdenweb.com
Wed Jun 13 07:21:39 EDT 2001
Cool. Two things:
a) Erm, who told you that was a decimal number? I definitely remember
thinking "that's a HEX number as I wrote it".
b) So you mean you won't reply to anything with decimal in it?
regards
Steve 108 (decimal)
--
http://www.holdenweb.com/
"thinkit" <thinkit8 at lycos.com> wrote in message
news:9g6c550qrb at drn.newsguy.com...
> 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 e420r-atl1.usenetserver.com>, "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.beer", "l.drinker", ["count(distinct s.bar)",
> >"nbars"]],
> > FROM=[["likes", "l"], ["serves", "s"]],
> > WHERE="l.beer=s.beer",
> > REST="group by l.beer, 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 "alltest.py", 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
> >
> >STARTING
> >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?
> >
> >regards
> > Steve
> >
> >
> >
> >
>
More information about the Python-list
mailing list