how to test for nesting inlist

cpsoct at my-deja.com cpsoct at my-deja.com
Sat Jan 20 03:23:12 EST 2001


Is there a way to test if a list in nested and if so how deep? so that
you could type

y=[1,2,3]
x=[1,[2,3]]

howDeep(y)
howDeep(x)

and it would return 0 (no nesting) for y and 1, for x (1 level of
nesting)

Is this possible? It would seem really useful, but i don't see anything
in the docs about how to do this.


cheers,
kevin parks
seoul korea
cpsoct at lycos.com


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list