<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def type_list(signature, doc, header):
 """ Construct a list of types, preferring type annotations to docstrings if they are available. Parameters signature : Signature Signature of thing doc : list of tuple Numpydoc's type list section Returns ------- list of str Markdown formatted type list """


    lines = []
    docced = set()
    lines.append(header)
    try:
        for names, types, description in doc:
            names, types = _get_names(names, types)
            unannotated = []
            for name in names:
                docced.add(name)
                try:
                    typ = signature.parameters[name].annotation
                    if typ == inspect._empty:
                        raise AttributeError
                    default = signature.parameters[name].default
                    type_string = string_annotation(typ, default)
                    lines.append(f"- `{name}`: {type_string}")
                    lines.append("\n\n")
                except (AttributeError, KeyError):
                    unannotated.append(name)  # No annotation

            if len(unannotated) > 0:
                lines.append("- ")
                lines.append(", ".join(f"`{name}`" for name in unannotated))
                if types != "" and len(unannotated) > 0:
                    lines.append(f": {mangle_types(types)}")
            lines.append("\n\n")
            lines.append(f"    {' '.join(description)}\n\n")
        for names, types, description in doc:
            names, types = _get_names(names, types)
            for name in names:
                if name not in docced:
                    try:
                        typ = signature.parameters[name].annotation
                        default = signature.parameters[name].default
                        type_string = string_annotation(typ, default)
                        lines.append(f"- `{name}`: {type_string}")
                        lines.append("\n\n")
                    except (AttributeError, KeyError):
                        lines.append(f"- `{name}`")
                        lines.append("\n\n")
    except Exception as e:
        print(e)
    return lines if len(lines) > 1 else []