Tim Peters <tim.one@comcast.net> writes: > > Oh yes they can be: > > > > >>> L = [] > > >>> t = (L, L) > > >>> L.append(L) > > >>> > > That's an example of a tuple *containing* a recursive structure; there's > still no way, starting at t, to get back to t. I think mutation is required > for that. Like > > L = [None] > t = (L, L) > L[0] = t Or, using Guido's example: >>> L=[] >>> t=(L,) >>> L.append(t) >>> t[0][0] is t True > It's not clear that this matters to the recursion-checker, though. It doesn't: You can't create a tuple that contains itself, except on the C level (which I would declare a bug in the C code that does so). So any cycle involving a tuple must involve a non-tuple object as well. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4