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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'string': 0.09; 'strings.': 0.09; 'subject:keys': 0.09; 'def': 0.12; '23,': 0.16; 'identifiers': 0.16; 'identifiers.': 0.16; 'kwargs': 0.16; 'subject:Non': 0.16; 'subject:expression': 0.16; 'syntax,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'print': 0.22; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'keys': 0.31; 'probably': 0.32; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'more': 0.64; 'believe': 0.68; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=K1ZcXFIcLQaYsLuJmYb4qULoI09O2jbxVee+W234fBs=; b=GPs1bCqY9p5nFk53hEhA8DP5xZbeP89N9d0CWFBXZLumomm4Zudz48QkZc1cUTOyhs 5a7ZmHqnfgZeNE+kDGEUXHGWpxl00ISnknfwnK/rJXjASIQPaBtKjrrSJmcwzViKxdEC cnPO2ZXxrDTwq2ZILiM5YVIxXOGNIaiWvRaxkLjrPtKBz+CZ58IosrhyGt5k+2qG3qHi JCwCsnBk1Qwesstk5UZLZgD450eAHICFJ2aie1+H3cMukX7Zd2zR8aMXNG5flP1nN+5I HsD1DmDwSUoVJeyto4XkDVn4y6jiSRfkPkj0rJFw3rzTHg62t755Ptvo9axzR5SWe6EP 6LAQ==
X-Received by 10.66.230.199 with SMTP id ta7mr15361585pac.153.1369340588242; Thu, 23 May 2013 13:23:08 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <519E6557.6050405@gmail.com>
References <519E6557.6050405@gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 23 May 2013 14:22:28 -0600
Subject Re: Non-identifiers in dictionary keys for **expression syntax
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2033.1369340597.3114.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369340597 news.xs4all.nl 15888 [2001:888:2000:d::a6]:54848
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45839

Show key headers only | 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