def descend(iterable):
    if hasattr(iterable, '__iter__'):
        for element in iterable:
            descend(element)
    else:
        do_something(iterable)

This will just do_something(object) to anything that is not an
iterable. Only use it if all of your nested structures are of the same
depth.

If you used it on the following list of lists

[[something],[[something_else],[other_thing]]]

it would modify something, something_else, and other_thing.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to