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 [...]? -- https://mail.python.org/mailman/listinfo/python-list