Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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; 'programmer': 0.03; 'subject:not': 0.03; 'syntax': 0.04; 'argument': 0.05; 'attribute': 0.07; 'wednesday,': 0.07; 'attributes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Why': 0.09; 'unified': 0.09; 'identifiers': 0.16; 'piotr': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject: \n ': 0.16; 'subject:accessing': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'later': 0.20; 'proposed': 0.22; 'header:User- Agent:1': 0.23; 'removed.': 0.24; 'equivalent': 0.26; 'header:X -Complaints-To:1': 0.27; "doesn't": 0.30; 'compared': 0.30; 'problem': 0.35; 'subject:with': 0.35; 'december': 0.35; 'something': 0.35; 'next': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'new': 0.61; 'day.': 0.63; 'taking': 0.65; 'account': 0.65; 'between': 0.67; 'invalid': 0.68; 'subject:there': 0.68; 'subject:being': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Neil Cerutti Subject: Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers? Date: Fri, 6 Dec 2013 14:07:51 +0000 (UTC) Organization: Norwich University References: <15912943-29a1-4365-b027-7bb8cec447f8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: jackman.norwich.edu User-Agent: slrn/0.9.9p1/mm/ao (Win32) 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386338903 news.xs4all.nl 2834 [2001:888:2000:d::a6]:41858 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61150 On 2013-12-04, Piotr Dobrogost wrote: > On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti > wrote: >> not something to do commonly. Your proposed syntax leaves the >> distinction between valid and invalid identifiers a problem >> the programmer has to deal with. It doesn't unify access to >> attributes the way the getattr and setattr do. > > Taking into account that obj.'x' would be equivalent to obj.x > any attribute can be accessed with the new syntax. I don't see > how this is not unified access compared to using getattr > instead dot... I thought of that argument later the next day. Your proposal does unify access if the old obj.x syntax is removed. -- Neil Cerutti