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


Groups > comp.lang.python > #45839 > unrolled thread

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

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2013-05-23 14:22 -0600
Last post2013-05-23 14:22 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromIan Kelly <ian.g.kelly@gmail.com>
Date2013-05-23 14:22 -0600
SubjectRe: Non-identifiers in dictionary keys for **expression syntax
Message-ID<mailman.2033.1369340597.3114.python-list@python.org>
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?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web