Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:not': 0.03; 'subject:Why': 0.09; 'cc:addr:python-list': 0.11; 'behave': 0.16; 'dict': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: \n ': 0.16; 'subject:accessing': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'implementing': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'idea,': 0.31; 'subject:with': 0.35; "can't": 0.35; 'classes': 0.35; 'possible.': 0.35; 'received:google.com': 0.35; 'method': 0.36; 'subject:?': 0.36; 'changing': 0.37; 'pm,': 0.38; 'though,': 0.39; 'even': 0.60; 'subject:there': 0.68; "it'd": 0.84; 'subject:being': 0.84; 'to:none': 0.92; '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:date:message-id:subject:from:cc :content-type; bh=pRufJaYE9muxNwCwRViRIeFIrCevFeDkbZSQfcNYsJY=; b=UcHDwcaqahRsTpkz2epuwxaFaG1y+nvBVwn3UNgZR2GjfEwDgWka1obAMHyI03hqaX zBLwiTQCeRhZp4Hz9MTYlwekfpCQ/af866cw0lmaQrNP9FEEp31zykaKBwSHIODyiFmN E19RUlcCptbxcinIvdbOYkEYTcrzZUyEoXzOFLhaj0TAQOApMQoiyCuEE2DvIo8r6UbM +HT0T+TOT7f/I6YuVWigcCTa/dBPNoa0P5l1DnmdfkqVGLmqmFDqP/Lxhfndu1Y03BNv HZopZK1TZ+QJs8NnRxctL3xT9xZPBP1lo1pppiILwFR36nbK+DfoQhnQHtHdMwPUDVAs 30CQ== MIME-Version: 1.0 X-Received: by 10.66.66.42 with SMTP id c10mr80536937pat.98.1386157201628; Wed, 04 Dec 2013 03:40:01 -0800 (PST) In-Reply-To: References: <15912943-29a1-4365-b027-7bb8cec447f8@googlegroups.com> <17gt99hg615jfm7bdid26185884d2pfdkf@4ax.com> <080d6a56-588b-425f-8968-8f77bc330427@googlegroups.com> <549180f1-fb98-4b59-b92f-5beceb1a6fb5@googlegroups.com> Date: Wed, 4 Dec 2013 22:40:01 +1100 Subject: Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386157205 news.xs4all.nl 2920 [2001:888:2000:d::a6]:35145 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61014 On Wed, Dec 4, 2013 at 10:30 PM, Jussi Piitulainen wrote: > Hm. Can't specific classes be made to behave this way even now by > implementing suitable underscored methods? Yup. Definitely possible. I don't think it'd be a good idea, though, not without somehow changing every dict method into a stand-alone function. ChrisA