On 05/23/2013 12:20 PM, Neil Cerutti wrote:
On 2013-05-23, Matthew Gilson <m.gils...@gmail.com> wrote:
That's fine, but what is a keyword argument? According to the glossary
(http://docs.python.org/3.3/glossary.html):
/"keyword argument/: an argument preceded by an identifier (e.g. name=)
in a function call or passed as a value in a dictionary preceded by **."
As far as I'm concerned, this leads to some ambiguity in
whether the keys of the mapping need to be valid identifiers or
not.
I don't see any ambiguity. A keyword argument is an argument
preceded by an identifier according to the definition. Where are
you perceiving wiggle room?
--> def func(**kwargs):
... print(kwargs)
...
--> d = {'foo bar baz':3}
--> func(**d)
{'foo bar baz': 3}
Even though 'foo bar baz' is not a valid identifier, and could not be passed as `func(foo bar baz = 3)`, it still worked
when going through a dict.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list