On Sat, Feb 15, 2014 at 5:44 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> 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 -- https://mail.python.org/mailman/listinfo/python-list