Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '16,': 0.03; 'literal': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'notation': 0.16; 'wrote:': 0.18; 'feb': 0.22; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'received:google.com': 0.35; 'there': 0.35; 'pm,': 0.38; 'space': 0.40; 'simple': 0.61; 'want:': 0.84; 'to:none': 0.92 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=yKS11jHymmSswwErPM3XHKLtmChA9QV+CTP8UZPmsAU=; b=BUi3K1rX597DywKogh3JUo0uF7EIdSchc8WZGvA5vpXkiUiddico3h8NktkchC4JXf nynbPpk4d7xO/uImnhplkeRtg4w4RjUB7uV0yot4k4olJfDsbFfjDoT7ozJ1LtWU/NMW P0uQ8ye3PbTOgBOS0gQow0ln4/eG8dTa8vkzNA1OzuPtMJcNIEedWbNPCy5BiFUWbvm/ QTlnhFdudzOzQKChjnvtSTYPKQkrg2+c32JRtRd/A8nyWLFr79d0L2u7rYJ+MRSZvyPL sYoxkBPnbAzMhjlFfv1295oD7WKXbcbhabQP8iRijllaLVn3Q29f87+jEKEkFQ2OZW6t XsVA== MIME-Version: 1.0 X-Received: by 10.68.201.10 with SMTP id jw10mr20034826pbc.25.1392545898067; Sun, 16 Feb 2014 02:18:18 -0800 (PST) In-Reply-To: <5300797c$0$29985$c3e8da3$5496439d@news.astraweb.com> References: <13208de8-0f85-4e60-b059-dc087c8fda41@googlegroups.com> <917ede6d-db7c-4a8c-8203-27677283776b@googlegroups.com> <871tz5piy0.fsf@elektro.pacujo.net> <87vbwho1i0.fsf@elektro.pacujo.net> <8761ofiio9.fsf@elektro.pacujo.net> <5300797c$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Sun, 16 Feb 2014 21:18:17 +1100 Subject: Re: Explanation of list reference 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392545902 news.xs4all.nl 2895 [2001:888:2000:d::a6]:58555 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66522 On Sun, Feb 16, 2014 at 7:40 PM, Steven D'Aprano wrote: > There are three simple ways to get the effect that you want: > > py> x = 1; x.__str__() # don't use a literal > '1' > py> (1).__str__() # parenthesize the literal > '1' > py> 1 .__str__() # offset it from the dot with a space > '1' Four: >>> 0o1.__str__() # use a literal notation that doesn't allow floats '1' ChrisA