Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45839

Re: Non-identifiers in dictionary keys for **expression syntax

References <519E6557.6050405@gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2013-05-23 14:22 -0600
Subject Re: Non-identifiers in dictionary keys for **expression syntax
Newsgroups comp.lang.python
Message-ID <mailman.2033.1369340597.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, May 23, 2013 at 12:52 PM, Matthew Gilson <m.gilson1@gmail.com> wrote:
> Using Cpython, we can do the following:
>
>      def func(**kwargs):
>           print kwargs
>
>      d = {'foo bar baz':3}
>
> So that might lead us to believe that the keys of the mapping do not need to
> be valid identifiers.  However, the previous function does not work with the
> following dictionary:
>
>     d = {1:3}
>
> because not all the keys are strings.  Is there a way to petition to get
> this more rigorously defined?

The string requirement is probably for optimization, but if the
argument is both sent and received using the ** syntax, is there a
good reason why only identifiers should be allowed?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Non-identifiers in dictionary keys for **expression syntax Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-23 14:22 -0600

csiph-web