Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100395

Re: Weird list conversion

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Weird list conversion
Date Mon, 14 Dec 2015 08:09:45 +1100
Lines 16
Message-ID <mailman.221.1450040994.12405.python-list@python.org> (permalink)
References <5926ced0-5b86-41f2-81e8-55cc6f71b78c@googlegroups.com> <mailman.216.1450036662.12405.python-list@python.org> <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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100395

Show key headers only | View raw


On Mon, Dec 14, 2015 at 7:31 AM, Erik <python@lucidity.plus.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Weird list conversion high5storage@gmail.com - 2015-12-13 11:45 -0800
  Re: Weird list conversion Laura Creighton <lac@openend.se> - 2015-12-13 20:57 +0100
    Re: Weird list conversion KP <kai.peters@gmail.com> - 2015-12-13 12:05 -0800
      Re: Weird list conversion Erik <python@lucidity.plus.com> - 2015-12-13 20:28 +0000
      Re: Weird list conversion Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-13 13:28 -0700
      Re: Weird list conversion Erik <python@lucidity.plus.com> - 2015-12-13 20:31 +0000
      Re: Weird list conversion Larry Hudson <orgnut@yahoo.com> - 2015-12-13 12:42 -0800
      Re: Weird list conversion Chris Angelico <rosuav@gmail.com> - 2015-12-14 08:09 +1100
  Re: Weird list conversion Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-13 12:59 -0700

csiph-web