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


Groups > comp.lang.python > #45844

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

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <m.gilson1@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; '"or': 0.09; 'ambiguity': 0.09; 'identifier': 0.09; 'subject:keys': 0.09; 'clause.': 0.16; 'definition.': 0.16; 'identifier,': 0.16; 'identifiers': 0.16; 'preceded': 0.16; 'subject:Non': 0.16; 'subject:expression': 0.16; 'url:html)': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'room': 0.29; "doesn't": 0.30; "i'm": 0.30; 'work.': 0.31; 'fine,': 0.31; 'keys': 0.31; 'received:132': 0.31; 'stuff': 0.32; 'url:python': 0.33; '(e.g.': 0.33; 'not.': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'keyword': 0.36; 'leads': 0.36; 'url:org': 0.36; 'message-id:@gmail.com': 0.38; 'mapping': 0.38; 'to:addr:python- list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'according': 0.40; 'even': 0.60; 'url:3': 0.61
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=ny5gYtCWjW+1fqLYBxZckTWuvMMHo9Q034LdkAKrtaA=; b=lrdokp478lS/+XYWbzHuuG9CXDiVRYoAuNoOTMQhhI9gEcs27t6WbZXpcnsiomIWe5 SXNNhPGw3oG+ZC3FKKKcMEulPTavdeYWhlMbIMVwObDVWoCglkGwNGBNPZAxygEzDHgy Wq3hQxsfCnL3PFH7/0XiRP9I8HI3BIt7eGv1Mz1G2lSPw9JcA5lacRmkV11IBMF4/0Ea Ae0VNL+n7R66lfRNAwUDTPKEpbaVEuUyY51aga/HNTFSg90PZKWHzJtidjMlcSgeZEGB cKy9VH9snakzKR0nz9JW3MdSO4gd8zrnzO1UjgH6DTbsUzC37GsuEEFol7oxg+qmC/BN ogCg==
X-Received by 10.52.29.172 with SMTP id l12mr5598063vdh.47.1369342161517; Thu, 23 May 2013 13:49:21 -0700 (PDT)
Date Thu, 23 May 2013 16:49:19 -0400
From Matthew Gilson <m.gilson1@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130330 Thunderbird/17.0.5
MIME-Version 1.0
To python-list@python.org
Subject Re: Non-identifiers in dictionary keys for **expression syntax
References <mailman.2029.1369335137.3114.python-list@python.org> <b078gcF5qh7U1@mid.individual.net>
In-Reply-To <b078gcF5qh7U1@mid.individual.net>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.2036.1369342164.3114.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369342164 news.xs4all.nl 16011 [2001:888:2000:d::a6]:44290
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45844

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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