Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'ambiguity': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'identifier': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'subject:keys': 0.09; '~ethan~': 0.09; 'def': 0.12; 'definition.': 0.16; 'identifier,': 0.16; 'identifiers': 0.16; 'preceded': 0.16; 'received:69.93': 0.16; 'subject:Non': 0.16; 'subject:expression': 0.16; 'url:html)': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'function': 0.29; "i'm": 0.30; 'fine,': 0.31; 'keys': 0.31; 'worked': 0.33; 'url:python': 0.33; '(e.g.': 0.33; 'not.': 0.33; 'could': 0.34; 'but': 0.35; 'keyword': 0.36; 'leads': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'according': 0.40; 'even': 0.60; 'url:3': 0.61; 'received:173': 0.61; 'dict.': 0.84 Date: Thu, 23 May 2013 12:37:18 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Non-identifiers in dictionary keys for **expression syntax References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.235]) [173.12.184.235]:35461 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369339060 news.xs4all.nl 15910 [2001:888:2000:d::a6]:39922 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45837 On 05/23/2013 12:20 PM, Neil Cerutti wrote: > On 2013-05-23, Matthew Gilson 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? --> def func(**kwargs): ... print(kwargs) ... --> d = {'foo bar baz':3} --> func(**d) {'foo bar baz': 3} Even though 'foo bar baz' is not a valid identifier, and could not be passed as `func(foo bar baz = 3)`, it still worked when going through a dict. -- ~Ethan~