def getList(x):
    """
    Return t as a list.
    """

    t = PL_copy_term_ref(x)
    head = PL_new_term_ref()
    result = []
    while PL_get_list(t, head, t):
        result.append(getTerm(head))
        head = PL_new_term_ref()

    return result
def getList ( x ) : t = PL_copy_term_ref ( x ) head = PL_new_term_ref ( ) result = [ ] while PL_get_list ( t , head , t ) : result . append ( getTerm ( head ) ) head = PL_new_term_ref ( ) return result
Return t as a list.