Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Weird list conversion Date: Mon, 14 Dec 2015 08:09:45 +1100 Lines: 16 Message-ID: References: <5926ced0-5b86-41f2-81e8-55cc6f71b78c@googlegroups.com> <3193bf38-82c3-4538-b500-5e23158898e6@googlegroups.com> <566DD4E0.50804@lucidity.plus.com> <566DD5A4.9040905@lucidity.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de HV132/+NY9qCYXhx4Kac0wM4jCM1hAcY8PjyOa0pMczw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'method,': 0.07; 'cc:addr:python-list': 0.09; 'combined.': 0.16; 'erik': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "objects'": 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'repr.': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'lists': 0.34; 'list': 0.34; 'received:google.com': 0.35; 'received:209.85': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'turn': 0.37; 'received:209': 0.38; 'mean': 0.38; 'called': 0.40; 'back': 0.62; 'fall': 0.66; 'chrisa': 0.84; "class's": 0.84; 'to:none': 0.91 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=Kx8ILm7jQ3Jn81GFkg+LUxp5hcgvgdF3v/ZsR8MHmsY=; b=TlIeq/Bvkcb9aeqjdJ1iDWhfz3P0Fdv9YLvnwIOpQC6YKgaK8NVxT4Rlkc6lTIxvnU 9CjCGvGGv+JuYIeRjrLoo6F7fAlA+Gr7Ms64XJaNOvE2tUMn5A9JeHwehek2TGTdbL9j IOC+pozGEN4rO7DrVei9i4WJs/WYVvKBKMtr9ZO3P+9DWC1Vg2K0CXjm0Anc/iU3igh0 TC9NVOEwImjpjxXSXMrgK93DaRGikZe51VZXhB1DY6eDLfL/oDR14zzEabYCebsMHjPa IWoeBcrPMyr5BgZwoewwXqg1/8tVPCBohCaV6p1sMhdoWpdazcKhX23CCFAYIuGfHm3B 2vdg== X-Received: by 10.107.3.163 with SMTP id e35mr24080444ioi.157.1450040985147; Sun, 13 Dec 2015 13:09:45 -0800 (PST) In-Reply-To: <566DD5A4.9040905@lucidity.plus.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100395 On Mon, Dec 14, 2015 at 7:31 AM, Erik wrote: > On 13/12/15 20:28, Erik wrote: >> >> When you call "print", then the list class's __repr__() method is called >> which in turn calls the contained objects' __repr__() methods in turn > > > I mean the __str__() method, not __repr__() in this case - however, the > answer is otherwise the same. It actually makes no difference; lists don't have __str__, and fall back on object.__str__, which returns self.__repr__(). Inside list.__repr__, the contained objects' reprs are combined. With lists, you always get the repr. :) ChrisA