Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '21,': 0.07; 'append': 0.09; 'literal': 0.09; 'received:internal': 0.09; 'python': 0.11; 'itself.': 0.14; 'all?': 0.16; 'crashed': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'pointers.': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'syntax,': 0.16; 'tuple': 0.16; 'tuples,': 0.16; 'wrote:': 0.18; 'least': 0.26; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'depth': 0.31; 'fri,': 0.33; 'implemented': 0.33; 'received:66': 0.35; "can't": 0.35; 'but': 0.35; 'version': 0.36; 'doing': 0.36; 'list': 0.37; 'received:10': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'from:no real name:2**0': 0.61; 'simply': 0.61; 'header:Message-Id:1': 0.63; 'protection': 0.63; 'special': 0.74; 'behavior': 0.77; '2014,': 0.84; 'whereas': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=NuAsQlXvMQCeNbCZLl6jFMJpajI=; b=KLlp xoDTGnhn7re0b8i3GQ5o43N38ToPEueE8wrIwj9DDRismCFkMGnVmyhUoA3e5Tfl Xr8rNADdWDhkVEJpDlNM1MEpSdXQxpwmbtZRLRdkY9430QIu+aAWT2fh6IYSWgdp T4pS45cSzD+r9WT8eiVRkAdnfLXVAgUmAbnJLgg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=NuAsQlXvMQCeNbCZLl6jFMJp ajI=; b=UIQNC2Ed/g0F8sKOVJaH1wF+KH+FItCV8nSigm8LwAR0Svnntq682+XU MhfAff9tTshwm1X8kJ+6h7mM+ApoHYvC2AbfTARphPoDDyLRg3QrEhMmbruX1Qn3 JilNzpJ7Cvf6w4jfGtPaFt83sf7WMgx52jCMpgexf6tY0JExqmI= X-Sasl-Enc: xpD/Q+rDa95QVvZ/eCCuqWgTO0QppOCTkRi8U3OHo1us 1416591555 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-a419c8a0 In-Reply-To: <87bno16nsw.fsf@elektro.pacujo.net> References: <931d12c0-12b3-4278-a9b9-1e2c32f138b3@googlegroups.com> <87bno16nsw.fsf@elektro.pacujo.net> Subject: Re: Infinitely nested containers Date: Fri, 21 Nov 2014 12:39:15 -0500 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416591558 news.xs4all.nl 2943 [2001:888:2000:d::a6]:43784 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81230 On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote: > Gill Shen : > > > How is this [nesting] behavior implemented under the hood? > > Pointers. > > > And why is this allowed at all? > > There's no reason not to. There's no reason not to allow it with tuples, but you can't do it. Mainly because doing it in a single literal would require special syntax, whereas you can simply append to a list a reference to itself. I think I tried on at least one python version and printing the tuple crashed with a recursion depth error, since it had no special protection for this case the way list printing does.