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


Groups > comp.lang.python > #81175

Re: Infinitely nested containers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.060
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; '21,': 0.07; 'cc:addr :python-list': 0.11; 'itself.': 0.14; 'all?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'repr()': 0.16; 'value;': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'this.': 0.32; 'fri,': 0.33; 'implemented': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'useful': 0.36; 'list': 0.37; 'list.': 0.37; 'checks': 0.38; 'nov': 0.38; 'list,': 0.38; 'pm,': 0.38; 'does': 0.39; 'how': 0.40; 'back': 0.62; 'carefully': 0.74; 'behavior': 0.77; 'careful': 0.91; 'to:none': 0.92
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=i26YkfxT3kptP9Wc5TEWe54WlfZbV0g77IPMHXg7Zrw=; b=EE33VIfBoFbWgEwxmbDRX93bI4c7/G3XTGseE3WkUypPNzgT0mlYbrU7X9/lfXPybW xIajsZ04J9T3Hsyxs17KcMVcLiAgfZpKZEtMAchKjmqzpf7k+YgOVI1zhHoJaGcF+R4f Tk8kyXzHpNAZXiYvVMiNFic1b+zEEMaeFUDGp53XG+IcnVCslefgsxTwBYdjuEcuFtZJ 5ljOc9I2CAOf+ClRqc7EQNZblk39mf/AM+Xoapl01n2b/ju5GF6PMZ+DzehZTh8W4oPK s7VVxL0s3EQsNdAKoeXbMHD5knVW59km1eowfYJ73ZOp6LNzQZIjrHdv2FRYU2ccX2QK n0wQ==
MIME-Version 1.0
X-Received by 10.42.64.143 with SMTP id g15mr4348983ici.59.1416553429247; Thu, 20 Nov 2014 23:03:49 -0800 (PST)
In-Reply-To <931d12c0-12b3-4278-a9b9-1e2c32f138b3@googlegroups.com>
References <931d12c0-12b3-4278-a9b9-1e2c32f138b3@googlegroups.com>
Date Fri, 21 Nov 2014 18:03:49 +1100
Subject Re: Infinitely nested containers
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.16085.1416553437.18130.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416553437 news.xs4all.nl 2973 [2001:888:2000:d::a6]:36608
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81175

Show key headers only | View raw


On Fri, Nov 21, 2014 at 4:54 PM, Gill Shen <gillarete@gmail.com> wrote:
> How is this behavior implemented under the hood? And why is this allowed at all? Is it just a curiosity or can you do something useful with it?

Simple: The list contains itself. When you dereference the list, you
get back the original list. It does have value; you just have to be
careful of any recursive operation like printing it out - the repr()
for a list carefully checks for this.

ChrisA

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


Thread

Infinitely nested containers Gill Shen <gillarete@gmail.com> - 2014-11-20 21:54 -0800
  Re: Infinitely nested containers Marko Rauhamaa <marko@pacujo.net> - 2014-11-21 09:00 +0200
    Re: Infinitely nested containers random832@fastmail.us - 2014-11-21 12:39 -0500
      Re: Infinitely nested containers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-22 15:43 +1100
        Re: Infinitely nested containers Chris Angelico <rosuav@gmail.com> - 2014-11-22 15:50 +1100
          Re: Infinitely nested containers Rustom Mody <rustompmody@gmail.com> - 2014-11-21 21:02 -0800
            Re: Infinitely nested containers Chris Angelico <rosuav@gmail.com> - 2014-11-22 16:09 +1100
              Re: Infinitely nested containers Rustom Mody <rustompmody@gmail.com> - 2014-11-21 22:03 -0800
        Re: Infinitely nested containers Ethan Furman <ethan@stoneleaf.us> - 2014-11-22 11:50 -0800
          Re: Infinitely nested containers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-23 16:59 +1100
            Re: Infinitely nested containers random832@fastmail.us - 2014-11-23 01:39 -0500
    Re: Infinitely nested containers Chris Angelico <rosuav@gmail.com> - 2014-11-22 04:47 +1100
    Re: Infinitely nested containers random832@fastmail.us - 2014-11-21 12:50 -0500
    Re: Infinitely nested containers Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-21 11:37 -0700
    Re: Infinitely nested containers Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-11-21 13:30 -0600
    Re: Infinitely nested containers Terry Reedy <tjreedy@udel.edu> - 2014-11-22 16:57 -0500
  Re: Infinitely nested containers Chris Angelico <rosuav@gmail.com> - 2014-11-21 18:03 +1100
  Re: Infinitely nested containers Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-21 10:13 -0700

csiph-web