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


Groups > comp.lang.python > #81229

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!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'languages.': 0.04; 'back.': 0.09; 'python': 0.11; 'all?': 0.16; 'tighter': 0.16; 'window;': 0.16; 'wrote:': 0.18; 'slightly': 0.19; 'thu,': 0.19; 'widget': 0.19; 'references': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'probably': 0.32; 'implemented': 0.33; 'common': 0.35; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'are,': 0.36; 'useful': 0.36; 'example,': 0.37; 'list': 0.37; 'nov': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'itself': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; '20,': 0.68; 'normal.': 0.68; 'containing': 0.69; 'behavior': 0.77
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=uPuTTMFFOaPZBxOniqpwkebe01l11oEeVqEQoks8aKI=; b=h5txCCzMNxLY7uCut4HR/k4mapsiezwenCSdmU4+jioAOIYE7gx0aylhGsPgy3Pay1 7GiT3KcsvNjOVcjAtXTowtTEefJZmAycpEYFE1AWIDXiFgTJ9uBg5pMAPGhX8YPUkEDN OweGnF5kD8A8luH7JLiFsyecXNUzohaPS2ovD3Z+6tmMPAgdvQT858PLxwOF5enHVemZ dHIF6pn53K6axDHGRYhtKI73OmZD0Co59LXFu5BQJRxZ667HaO1VUMNIiVeIipEZmdOe /b8OLowy1C8ju4BxW1ahWPgkBHxETFMmUx9AG0aJjo8wSgL4ROdohqohrLyyZKPRx0RE WYEQ==
X-Received by 10.70.102.234 with SMTP id fr10mr8779299pdb.145.1416590064728; Fri, 21 Nov 2014 09:14:24 -0800 (PST)
MIME-Version 1.0
In-Reply-To <931d12c0-12b3-4278-a9b9-1e2c32f138b3@googlegroups.com>
References <931d12c0-12b3-4278-a9b9-1e2c32f138b3@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 21 Nov 2014 10:13:44 -0700
Subject Re: Infinitely nested containers
To Python <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.16113.1416590068.18130.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416590068 news.xs4all.nl 2954 [2001:888:2000:d::a6]:36371
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81229

Show key headers only | View raw


On Thu, Nov 20, 2014 at 10: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?

Reference cycles are common in Python and other OO languages. For
example, adding a widget to a window; the window contains references
to its child widgets, and it's probably useful for the widgets to know
what their parents are, so they would hold references back.

A list containing itself is similarly a reference cycle. I don't know
off-hand of any use for this specific case, but it's just a slightly
tighter cycle than normal.

Back to comp.lang.python | Previous | Next — Previous 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