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


Groups > comp.lang.python > #81337

Re: Infinitely nested containers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '(python': 0.07; 'none)': 0.09; 'received:internal': 0.09; 'python': 0.11; '23,': 0.16; 'finds': 0.16; 'itself,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'really?': 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; 'tuple': 0.16; 'tuple,': 0.16; 'tuple.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'print': 0.22; 'fine': 0.24; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; "d'aprano": 0.31; 'routine': 0.31; 'steven': 0.31; 'received:66': 0.35; 'list': 0.37; 'received:10': 0.37; 'nov': 0.38; 'to:addr :python-list': 0.38; 'issue': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'conversion': 0.61; 'header:Message-Id:1': 0.63; 'more': 0.64; '2014,': 0.84; 'fact.': 0.84; 'measure.': 0.84; 'remembering': 0.84; 'str.': 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=UwO20rJeFhxsovuBVQHh5qjFRf8=; b=sO42 IdK6jt3CacnVQtO2EVnqlXzTQcaJUxxKnsNGlfol5TY7AX1bNQrNYEQegVh4TYYy w3HotmYEXv/ENJBp8US+sTeJyEB5YDnucgY8coxsI5Q47xK0flX6N9wZnCkp4E8+ Zl/C5wlQ/Wl7H7eLX23XPuOFTT0SzcVlGU5G4H8=
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=UwO20rJeFhxsovuBVQHh5qjF Rf8=; b=aq16EQ5glF7/Nox9hIVPqIrUsTS17OSueSIewGm9IrFahkY28JIrWeSJ 1dPNbypjSQSTevKfRM9+EcQ/2JgjaAFT2DUzAiFFt2Y++NUjuHCI201BzeoqWNKX eANzcySC2IUVkO8ocUYNYItdIw+UhB3Xt+Q/+ovDSCISFyi4uS8=
X-Sasl-Enc 1rbbo4MyoeHb5zWwlRzSlV/d9OwHh7P4vowaGXtegV0V 1416724796
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 <547177a5$0$12989$c3e8da3$5496439d@news.astraweb.com>
References <931d12c0-12b3-4278-a9b9-1e2c32f138b3@googlegroups.com> <87bno16nsw.fsf@elektro.pacujo.net> <mailman.16114.1416591558.18130.python-list@python.org> <54701468$0$12986$c3e8da3$5496439d@news.astraweb.com> <mailman.16142.1416685847.18130.python-list@python.org> <547177a5$0$12989$c3e8da3$5496439d@news.astraweb.com>
Subject Re: Infinitely nested containers
Date Sun, 23 Nov 2014 01:39:56 -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 <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.16163.1416724802.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416724802 news.xs4all.nl 2956 [2001:888:2000:d::a6]:33201
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81337

Show key headers only | View raw



On Sun, Nov 23, 2014, at 00:59, Steven D'Aprano wrote:
> >> It works fine now (Python 3.3).
> >> 
> >> py> L = []
> >> py> t = (L, None)
> >> py> L.append(L)
> >> py> L.append(t)  # For good measure.
> >> py> print(t)
> >> ([[...], (...)], None)
> > 
> > This is a tuple in a list in a tuple, not a tuple in a tuple.
> 
> Really? I hadn't noticed.
> 
> *wink*
> 
> It's still a tuple in itself, recursively, and the tuple to str
> conversion
> routine still has to deal with the fact.

Does it, or does it punt to the list to str routine?

Anyway, on python 2.7, print and str do not work the same way for
tuples. I'm remembering more about this issue now, and it was _strictly_
on print, not on str.
>>> t
([[...], ([...], None)], None)
>>> print(t)
([[...], ([...], None)], None)
>>> str(t)
'([[...], (...)], None)'


Notice that print never does (...), only [...]. And if it never finds a
[...]?

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