how to test for nesting inlist
Patricia Hawkins
phawkins at spamnotconnact.com
Mon Jan 22 14:54:38 EST 2001
>>>>> "AM" == Alex Martelli <aleaxit at yahoo.com> writes:
AM> <cpsoct at my-deja.com> wrote in message news:94h7pi$b86$1 at nnrp1.deja.com...
>> What are list comprehensions? I have looked and looked and looked in
>> books and on www.python.org and i see no mention of these. Is this
AM> A list comprehension is a syntax form such as:
AM> [<expression> for <var> in <sequence>]
Like this:
def howDeep2(x):
if type(x) != type([]):
return 0
return 1 + reduce(max, [howDeep(y) for y in x])
--
Patricia J. Hawkins
Hawkins Internet Applications, LLC
More information about the Python-list
mailing list