[Python-Dev] repeated keyword arguments

Guido van Rossum guido at python.org
Sat Jun 28 17:38:41 CEST 2008


On Sat, Jun 28, 2008 at 1:30 AM, tomer filiba <tomerfiliba at gmail.com> wrote:
> On Jun 28, 12:56 am, "Guido van Rossum" <gu... at python.org> wrote:
>> No, it could just be a harmless typo in a long argument list.
>
> to elaborate on this point a little, i came across this error when i
> ported my code to 2.4. i used the optparse class which takes 10's of
> kwargs, and it turned out i'd given the same parameter twice (the
> infamous copy-paste problem).
>
> so on the one hand, it was a harmless typo (because the latest
> instance was taken). on the other hand, it's a good thing i tested it
> on 2.4, or i'd never notice the repeated argument, which may have led
> to weird runtime errors (if the order of the params was changed).
>
> i'd be in favor of fixing this in 2.5, just to eliminate possibly hard-
> to-debug runtime errors. since it's a syntax error, it would be early-
> noticed when the code is first run/imported, and it wouldn't require
> the original author of the code to fix.

But your anecdote is exactly why I don't want it fixed in 2.5. Your
code was working, the typo was harmless. I don't want upgrades from
2.5.2 to 2.5.3 (or any x.y.z to x.y.(z+1)) to break code that was
working before the upgrade! This is a principle we've adopted for such
point-point upgrades for a long time. Also note that it took a long
time before this was first reported, so it's not exactly like it's an
important or frequent problem.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list