[Python-bugs-list] Byte code compiler missed duplicate keyword args (PR#81)

guido@CNRI.Reston.VA.US guido@CNRI.Reston.VA.US
Wed, 15 Sep 1999 17:58:10 -0400 (EDT)


> Python 1.5.2 silently allows multiple keyword arguments in function definitions
> as demonstrated by the following code snippet:
> 
> Python 1.5.2+ (#35, Aug 26 1999, 10:08:41)  [GCC 2.7.2.3] on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> def f(a=0,a=0):
> ...   print a
> ... 

Oops, you're right.  It's not restricted to arguments with defaults
either:

>>> def f(a,a): print a

>>> f(1,2)
2

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