Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'syntax': 0.04; 'float': 0.07; 'toss': 0.09; 'confuse': 0.16; 'literal.': 0.16; 'parentheses': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'feb': 0.22; '>>>': 0.22; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'received:google.com': 0.35; 'starting': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'ian': 0.60; "you're": 0.61; 'invalid': 0.68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=xLdaO3IMkJ/V3cn0cTRx9k/w6FoY4gBhkJTgM2PmWHA=; b=YgAxuXrWMXCndhVzptOXAxoptyeMMMv762p6lW5+jbBNUJ1AAVegdrdALGCqgiUHFR qJhn8VCtzES+AhHiXHLZJdCh1fIKMJTUrsTlj+1sdlXRrN+GMwiztDdvK9k94I7ru/1W G3eusuPFYsiZMVbIzFE7AmtJneB/qfLfh7jIdu7EMEx0a9P/2iVUM700cOAArNMKW/W9 VkyocMxtHV6PSdIK3QnYkkTTIDEu+GrsmbdKkmFB19wu8lBZYxOlWhkpqQoaTo2Lwts/ /nXPaEblEqvtw8jqtaeRTup0T8IynlFB1J3i2qXzV6Jc6NxLvRF5y77r4CkmH36dE31v 5Beg== X-Received: by 10.66.138.40 with SMTP id qn8mr103102pab.154.1392539777633; Sun, 16 Feb 2014 00:36:17 -0800 (PST) MIME-Version: 1.0 In-Reply-To: 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> From: Ian Kelly Date: Sun, 16 Feb 2014 01:35:37 -0700 Subject: Re: Explanation of list reference To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 1392539780 news.xs4all.nl 2854 [2001:888:2000:d::a6]:33157 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66517 On Sun, Feb 16, 2014 at 1:28 AM, Ian Kelly wrote: > > On Feb 16, 2014 1:11 AM, "Marko Rauhamaa" wrote: >> Case in point, if everything is a reference, how come: >> >> >>> "hello".__str__() >> 'hello' >> >>> 1.__str__() >> SyntaxError: invalid syntax > > You need parentheses around the 1. Otherwise you confuse the lexer, which > thinks you're starting a float literal. > >>>> (1).__str__() > '1' Or if the parentheses bother you, you can also just toss in some whitespace: >>> 1 .__str__() '1'