[Python-bugs-list] [ python-Bugs-687644 ] Functions does not accept keyword arguments

SourceForge.net noreply@sourceforge.net
Sun, 16 Feb 2003 14:20:16 -0800


Bugs item #687644, was opened at 2003-02-16 23:20
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=687644&group_id=5470

Category: Parser/Compiler
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Viktor Ferenczi (complex)
Assigned to: Nobody/Anonymous (nobody)
Summary: Functions does not accept keyword arguments

Initial Comment:
Functions does not accept keyword arguments if argument list specified. Interactive session:

ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on
Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def fn(*args,**kw): print 'args=%r, kw=%r'%(args,kw)
...
>>> fn(1,2,a=3,b=4)
args=(1, 2), kw={'a': 3, 'b': 4}
>>> al=[1,2]
>>> kd={'a':3,'b':4}
>>> fn(*al,**kd)
args=(1, 2), kw={'a': 3, 'b': 4}
>>> fn(1,2,**kd)
args=(1, 2), kw={'a': 3, 'b': 4}
>>> fn(*al,a=3,b=4)
  File "<stdin>", line 1
    fn(*al,a=3,b=4)
           ^
SyntaxError: invalid syntax

It's valid to apply a keyword dictionary and an argument list at the same time. Keyword dictionary can be applied with real arguments. Python should allow applying an argument list while passing real keyword arguments. As far as I know, it should cause no ambiguous syntax.

- Complex -

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=687644&group_id=5470