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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'syntax': 0.04; 'beginner': 0.05; 'float': 0.07; 'confuse': 0.16; 'literal.': 0.16; 'parentheses': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'feb': 0.22; '>>>': 0.22; '>>>': 0.24; 'question': 0.24; '>': 0.26; 'equivalent': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'easier': 0.31; 'skip:& 30': 0.33; 'received:google.com': 0.35; 'starting': 0.37; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; "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:date:message-id:subject:from:to :content-type; bh=229uV8oXD34dk52jwA7B9gmw+IVgCZmfsWi0BuBEzRw=; b=QQnRgRoviNGMZPDcb+9xw76k2eBW86EQcXh7Zi7eqCSZb9LsPSnHEXCaoUTYkfLvFw E4UGm91MssCUqWvhDmQUcEIaz2SkwFTUpYKRuSjLH4MM4EInQcNUJatajm4lQQjarumK HfR2kU7/aanN5r+9Hq6BBxabBG96XoNN6gwIGGzQ+M+amkZdqzESPH0fnjpg4JTuNFzi qWEP045TE0/kRPaDny2aLlcMAiuLBnMKZWVG7uZRhtwEF/hSZqsyVF3VYNBaC8qdVNtB BjFoKRtRr3/d8a9toJ5M78V6JjxjJxCq/rjX30nmpyidgG9Ro3YknUTMr8cCMUqdSv+o hvHA== MIME-Version: 1.0 X-Received: by 10.68.213.41 with SMTP id np9mr19427910pbc.90.1392539314470; Sun, 16 Feb 2014 00:28:34 -0800 (PST) In-Reply-To: <8761ofiio9.fsf@elektro.pacujo.net> 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> Date: Sun, 16 Feb 2014 01:28:34 -0700 Subject: Re: Explanation of list reference From: Ian Kelly To: Python Content-Type: multipart/alternative; boundary=e89a8f64772f2cc41204f281d34d 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: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392539318 news.xs4all.nl 2847 [2001:888:2000:d::a6]:58435 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66515 --e89a8f64772f2cc41204f281d34d Content-Type: text/plain; charset=ISO-8859-1 On Feb 16, 2014 1:11 AM, "Marko Rauhamaa" wrote: > > Marko Rauhamaa : > > > Conceptually, the "everything is a reference" and the "small"/"big" > > distinction are equivalent (produce the same outcomes). The question > > is, which model is easier for a beginner to grasp. > > 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' --e89a8f64772f2cc41204f281d34d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Feb 16, 2014 1:11 AM, "Marko Rauhamaa" <marko@pacujo.net> wrote:
>
> Marko Rauhamaa <marko@pacujo.ne= t>:
>
> > Conceptually, the "everything is a reference" and the &= quot;small"/"big"
> > distinction are equivalent (produce the same outcomes). The quest= ion
> > is, which model is easier for a beginner to grasp.
>
> Case in point, if everything is a reference, how come:
>
> =A0 =A0>>> "hello".__str__()
> =A0 =A0'hello'
> =A0 =A0>>> 1.__str__()
> =A0 =A0SyntaxError: invalid syntax

You need parentheses around the 1. Otherwise you confuse the= lexer, which thinks you're starting a float literal.

>>> (1).__str__()
'1'

--e89a8f64772f2cc41204f281d34d--