Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!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; ';-)': 0.03; 'subject:not': 0.03; 'syntax': 0.04; 'dynamically': 0.07; 'wednesday,': 0.07; 'acceptance.': 0.09; 'attributes': 0.09; 'latter': 0.09; 'lawrence': 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; 'variant': 0.09; 'developer': 0.10; 'developers,': 0.11; 'python': 0.11; 'bug': 0.12; 'jan': 0.12; 'wrote': 0.14; 'changes': 0.15; '15-20': 0.16; 'attributes,': 0.16; 'backward': 0.16; 'dot,': 0.16; 'key/value': 0.16; 'piotr': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:accessing': 0.16; 'this)': 0.16; 'way;': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'later': 0.20; '>>>': 0.22; 'code,': 0.22; 'saying': 0.22; 'tests': 0.22; 'header:User-Agent:1': 0.23; 'right.': 0.26; 'tracker': 0.26; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'raise': 0.29; 'tim': 0.29; "doesn't": 0.30; '(which': 0.31; 'code': 0.31; 'too.': 0.31; '(on': 0.31; '3.2': 0.31; 'chase': 0.31; 'explained': 0.31; 'names.': 0.31; 'publicly': 0.31; 'could': 0.34; 'subject:with': 0.35; 'december': 0.35; 'done.': 0.35; 'but': 0.35; 'there': 0.35; 'accessing': 0.36; 'method': 0.36; 'subject:?': 0.36; 'should': 0.36; 'unit': 0.37; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'either': 0.39; 'received:org': 0.40; 'reviewed': 0.60; 'new': 0.61; 'received:173': 0.61; "you're": 0.61; 'save': 0.62; 'high': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'approved': 0.65; 'kept': 0.65; 'subject:there': 0.68; 'obvious': 0.74; '3.4': 0.84; 'fact.': 0.84; 'received:fios.verizon.net': 0.84; 'subject:being': 0.84; 'tricky': 0.84; 'universally': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers? Date: Wed, 04 Dec 2013 21:58:23 -0500 References: <15912943-29a1-4365-b027-7bb8cec447f8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 In-Reply-To: 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: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386212319 news.xs4all.nl 2870 [2001:888:2000:d::a6]:45915 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61072 On 12/4/2013 3:46 PM, Mark Lawrence wrote: > On 04/12/2013 20:35, Piotr Dobrogost wrote: >> On Wednesday, December 4, 2013 2:06:44 AM UTC+1, Tim Chase wrote: >>> >>> I think random832 is saying that the designed purpose of setattr() >>> was to dynamically set attributes by name, so they could later be >>> accessed the traditional way; not designed from the ground-up to >>> support non-identifier names. But because of the getattr/setattr >>> machinery (dict key/value pairs), it doesn't prevent you from having >>> non-identifiers as names as long as you use only the getattr/setattr >>> method of accessing them. >> >> Right. If there's already a way to have attributes with these >> "non-standard" names Fact. >> (which is a good thing) Opinion, not universally shared by developers, or 'good thing only as long as kept obscure'. >> then for uniformity with dot access to attributes with "standard" names In a later post (after you wrote this) I explained that standard names are not always accessed with a dot, and that uniformity is impossible. >> there should be a variant of dot access allowing to access >> these "non-standard" named attributes, too. More opinion. I am sure that I am not the only developer who disagrees. > The obvious thing to do is to either raise this on python ideas, or if > you're that confident about it raise an issue on the bug tracker with a > patch, which would include changes to unit tests and documentation as > well as code, get it reviewed and approved and Bob's your uncle, job > done. I think the latter would be foolish. Syntax changes have a high bar for acceptance. They should do more than save a few keystrokes. Use of new syntax makes code backward incompatible. New or changed Python modules can be backported (as long as they do not use new syntax ;-) either privately or publicly (on PyPI). 3.2 had no syntax changes; 3.3 one that I know of ('yield from'), which replaced about 15-20 *lines* of very tricky code; 3.4 has none that I can remember. -- Terry Jan Reedy