Alan Daniels daniels at mindspring.com
Sat Mar 18 05:48:32 CET 2000

On Fri, 17 Mar 2000 14:14:57 GMT, the infinitely wise Jeff Pinyan
(jeffp at crusoe.net) spoke forth to us, saying...

>It's Python's way of saying you have a circular data structure.

Interesting. Is there a programmatic way to check for this? I didn't
see any mention of it in the FAQ. If I do:

>>> a = []
>>> a.append(a)
>>> type(a[0])
<type 'list'>

All you get is that its a list, nothing else. It would be nice to have
some more bulletproof way than the only other approach I can think of:

>>> def IsRecursiveList(x):
>>>     return str(x) == '[[...]]'

Any ideas?

Alan Daniels
daniels at mindspring.com
daniels at cc.gatech.edu

More information about the Python-list mailing list