Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45844
| Date | 2013-05-23 16:49 -0400 |
|---|---|
| From | Matthew Gilson <m.gilson1@gmail.com> |
| Subject | Re: Non-identifiers in dictionary keys for **expression syntax |
| References | <mailman.2029.1369335137.3114.python-list@python.org> <b078gcF5qh7U1@mid.individual.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2036.1369342164.3114.python-list@python.org> (permalink) |
On 05/23/2013 03:20 PM, Neil Cerutti wrote:
> On 2013-05-23, Matthew Gilson <m.gilson1@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?
>
The wiggle room comes from the "or passed as a value in a dictionary"
clause. We sort of get caught in a infinite loop there because the
stuff that can be passed in a dictionary is a keyword which is an
identifer=expression or something passed as a value in a dictionary ...
Also the fact that:
func(**{"foo bar baz":1})
works even though `foo bar baz` isn't a valid identifier, but:
func(**{1:3})
doesn't work.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Non-identifiers in dictionary keys for **expression syntax Matthew Gilson <m.gilson1@gmail.com> - 2013-05-23 14:52 -0400
Re: Non-identifiers in dictionary keys for **expression syntax Neil Cerutti <neilc@norwich.edu> - 2013-05-23 19:20 +0000
Re: Non-identifiers in dictionary keys for **expression syntax Ethan Furman <ethan@stoneleaf.us> - 2013-05-23 12:37 -0700
Re: Non-identifiers in dictionary keys for **expression syntax Matthew Gilson <m.gilson1@gmail.com> - 2013-05-23 16:49 -0400
csiph-web