recursion.
def get_As(L):
    res = []
    for elem in L:
        if isinstance(elem, A):
            res.append(elem)
        elif isinstance(elem, list):
            res += get_As(elem)
    return res

i also have a Tree class in my rc:
http://home.comcast.net/~faulkner612/programming/python/pythonrc.py

yomgui wrote:
> Hi,
>
> I have a list of data (type A)
> my list can includes element of type A or a lists,
> these list can includes element of type A or a lists, and so on ...
>
> is there a simple way to obtain a single list of all the elemets
> of type A ?
> 
> thanks
> 
> yomgui

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

Reply via email to