Recursive structures

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Mon Dec 20 13:21:08 EST 2004


Thank you very much Thomas Güttler for you quick answer, but I think
your program doesn't contain an algorithm to spot cycles (like the
usual cyclic graph algorithm). In my first post there was an assert to
spot this problem:

l = [0]
m = [l, l]
print m
print isrecursive(m)

Gives:
[[0], [0]]
1

m contains a shared reference, but not a recursive one.
Thank you Fredrik Lundh too,
bear hugs,
Bearophile




More information about the Python-list mailing list