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


Groups > comp.lang.python > #6297

Re: Puzzled by list-appending behavior

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Puzzled by list-appending behavior
References <16c21256-48df-416a-971f-de49ca4cc981@x6g2000yqj.googlegroups.com>
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
Date Thu, 26 May 2011 15:11:56 +1000
Message-ID <87ei3mavvn.fsf@benfinney.id.au> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
Cancel-Lock sha1:8YyQJYk71/7xyXp+DivZU4ZHwpk=
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Lines 15
Organization Unlimited download news at news.astraweb.com
NNTP-Posting-Host 87c9265e.news.astraweb.com
X-Trace DXC==An^nAe0HmITE2gdJ]P=SGL?0kYOcDh@J7^o:UA4R?cEFRPSXaZN\EB]G;2>V^?kWCbEW9A[5UK?ENZ[SL`C\KgC2m<fOOSTddO
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6297

Show key headers only | View raw


Uncle Ben <bgreen@nycap.rr.com> writes:

> Can someone explain this to me?

Yes, the documentation for that function (‘list.append’) can explain it.

In short: if a method modifies the instance, that method does not return
the instance. This policy holds for the built-in types, and should be
followed for user-defined types also.

-- 
 \      “[I]t is impossible for anyone to begin to learn that which he |
  `\                thinks he already knows.” —Epictetus, _Discourses_ |
_o__)                                                                  |
Ben Finney

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


Thread

Puzzled by list-appending behavior Uncle Ben <bgreen@nycap.rr.com> - 2011-05-25 21:46 -0700
  Re: Puzzled by list-appending behavior Ben Finney <ben+python@benfinney.id.au> - 2011-05-26 15:11 +1000
  Re: Puzzled by list-appending behavior Chris Rebert <clp2@rebertia.com> - 2011-05-25 22:17 -0700
  Re: Puzzled by list-appending behavior Chris Angelico <rosuav@gmail.com> - 2011-05-26 17:20 +1000
  Re: Puzzled by list-appending behavior Chris Angelico <rosuav@gmail.com> - 2011-05-26 17:23 +1000
  Re: Puzzled by list-appending behavior Uncle Ben <bgreen@nycap.rr.com> - 2011-05-26 00:33 -0700
  Re: Puzzled by list-appending behavior Chris Rebert <clp2@rebertia.com> - 2011-05-26 01:09 -0700
  Re: Puzzled by list-appending behavior MRAB <python@mrabarnett.plus.com> - 2011-05-26 16:58 +0100
    Re: Puzzled by list-appending behavior Tim Roberts <timr@probo.com> - 2011-05-26 23:34 -0700
      Re: Puzzled by list-appending behavior MRAB <python@mrabarnett.plus.com> - 2011-05-27 17:02 +0100
  Re: Puzzled by list-appending behavior Chris Angelico <rosuav@gmail.com> - 2011-05-27 02:04 +1000
  Re: Puzzled by list-appending behavior John Ladasky <ladasky@my-deja.com> - 2011-05-26 11:27 -0700
    Re: Puzzled by list-appending behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-27 01:59 +0000
      Re: Puzzled by list-appending behavior Chris Angelico <rosuav@gmail.com> - 2011-05-27 13:24 +1000
        Re: Puzzled by list-appending behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-27 03:52 +0000
          Re: Puzzled by list-appending behavior Chris Angelico <rosuav@gmail.com> - 2011-05-27 14:10 +1000
          RE: Puzzled by list-appending behavior "Prasad, Ramit" <ramit.prasad@jpmchase.com> - 2011-05-27 13:58 -0400
          Re: Puzzled by list-appending behavior Ethan Furman <ethan@stoneleaf.us> - 2011-05-27 11:56 -0700
  Re: Puzzled by list-appending behavior Terry Reedy <tjreedy@udel.edu> - 2011-05-26 14:44 -0400
  RE: Puzzled by list-appending behavior "Prasad, Ramit" <ramit.prasad@jpmchase.com> - 2011-05-26 15:34 -0400
  Re: Puzzled by list-appending behavior Terry Reedy <tjreedy@udel.edu> - 2011-05-26 17:36 -0400

csiph-web