Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!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.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; "person's": 0.09; 'cc:addr :python-list': 0.11; '(out': 0.16; 'cease': 0.16; 'exist.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'garbage': 0.16; 'itself,': 0.16; 'none);': 0.16; "object's": 0.16; 'recognise': 0.16; 'throw': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'certainly': 0.24; 'either.': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'equivalent': 0.26; 'references': 0.26; 'header:In-Reply-To:1': 0.27; 'room': 0.29; "doesn't": 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; '(which': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'lists': 0.32; 'this.': 0.32; 'themselves': 0.32; 'there,': 0.34; 'problem': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'possible': 0.36; 'pm,': 0.38; 'moving': 0.39; 'either': 0.39; 'simply': 0.61; 'person,': 0.68; 'containing': 0.69; 'promptly': 0.84; 'western': 0.86; 'doctor': 0.91; 'television': 0.91; 'to:none': 0.92; 'room,': 0.93 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=CT6Y9fCEwL6CDu3+Rpu5WQ1D1qG0eSriho95Gt+32jc=; b=L5QQIvPtehi6z0jb79vihiLqw4zs0SC48xakeBGmyiMD7wnK+XqLq3YC1njFgeqN/6 UWZuNPdEe2scqhQ2MEN7GlG9RqZeu5xqZaNAU7g28p52zrUaiM/229zOD1hkt7w30eA4 MhmXTSdsJ1AAoE9nGQJS7XRpLmPNogrlpoxCz54oiIKVAj7RO3dtDnNsR5iYzcmH6GFs ZA1wd+md2TO92lywdThWdsXpVcNP5nR9qoVEoBOIsWTvsRE08TyN+A9pimVeacJXEZE3 0NfiiZZQ49wCkA2+8qwzS9zGp8BHIteJmEVUjLqWO1UHJ5wgiodM6vYcVsZQcsUL/3me uJ5Q== MIME-Version: 1.0 X-Received: by 10.66.192.74 with SMTP id he10mr13918162pac.126.1392447900995; Fri, 14 Feb 2014 23:05:00 -0800 (PST) In-Reply-To: <52ff0cb7$0$29973$c3e8da3$5496439d@news.astraweb.com> 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> <87mwhtnzdu.fsf@elektro.pacujo.net> <59c876d3-02f5-4f5a-8728-a5098472e03d@googlegroups.com> <6e96ba97-8ad0-4dad-9d11-b27bf9b237d0@googlegroups.com> <52ff0cb7$0$29973$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 15 Feb 2014 18:05:00 +1100 Subject: Re: Explanation of list reference From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392447905 news.xs4all.nl 2866 [2001:888:2000:d::a6]:53220 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66388 On Sat, Feb 15, 2014 at 5:44 PM, Steven D'Aprano wrote: > You just need to recognise that > objects can contain themselves: > > py> L = [] > py> L.append(L) > py> L in L > True > > > Of course, if you are a fan of the Doctor Who television show, you won't > be concerned by this. If the TARDIS can materialise inside itself, then > there isn't any problem with lists containing themselves either. They certainly can. In my MUD, every object has a location (which may be the equivalent of None); generally, a person's location is a room, and a grabbable object's location is either a room or a person, but it's possible for a room to have a location... a Dungeon Master can create a workroom, which is in his inventory, and then enter that workroom. Incidentally, the destruction of an object simply involves moving it to nowhere. Since "nowhere" doesn't keep any references to the things put there, those objects promptly cease to exist. It's just like Western society - you don't actually destroy anything, you just throw it away (out of sight, out of mind), and let the garbage collector dispose of it for you :) ChrisA