[New-bugs-announce] [issue5382] Allow Python keywords as keyword arguments for functions.

David Kerkeslager report at bugs.python.org
Fri Feb 27 17:25:38 CET 2009


New submission from David Kerkeslager <david.kerkeslager at gmail.com>:

This problem arose in this thread:
http://www.python-forum.org/pythonforum/viewtopic.php?f=2&t=11606

Basically, we have the following function which will generate an XHTML 
node:

def xhtmlNode(tag, **attr):...

If we call:

xhtmlNode('div',class='sidebar')

... it should generate the xhtml:

<div class='sidebar'></div>

However, this isn't possible because the 'class' keyword in Python 
blocks it.  Since this is a key in a dictionary (attr['class']) this 
shouldn't be a problem.  As far as I know, there is no parsing issue 
with this either.

Could we allow Python keywords to be keyword arguments?  The use case 
above shows that this is useful in a real-life situation.

----------
components: Interpreter Core
messages: 82837
nosy: Imagist
severity: normal
status: open
title: Allow Python keywords as keyword arguments for functions.
type: feature request
versions: Python 3.0, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5382>
_______________________________________


More information about the New-bugs-announce mailing list