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 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 Date: Thu, 26 May 2011 15:11:56 +1000 Message-ID: <87ei3mavvn.fsf@benfinney.id.au> 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 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