import re


def parse_polynomial(poly: str) -> list:
    """Get polynomial coefficients froms string.
    
    May not be used with other mathematical functions.
    
    Parameters
    ----------
    poly : str
        Polynomial string.
    
    Returns
    -------
    list of floats
        Polynomial coefficients [x_0, x_1, ..., x_n].
    """
    powers = re.findall("([\\- ]*[0-9\\.]*)([ ]*x\\^)([0-9]*)", poly)
    linear = re.findall("([\\- ]*[0-9\\.]*)([ ]*x)(?!\\^)", poly)
    constants = re.findall("(?<![x\\^]{1})([\\- ]*[0-9\\.]+)(?![0-9 \\.]*x)",
                           poly)
    coeff = dict()
    for co in constants:
        co = float(co.replace(' ', '').strip())
        coeff[0] = coeff.get(0, 0) + co
    
    for co, _ in linear:
        co = co.replace(' ', '').strip()
        co = 1 if len(co) == 0 else co
        co = -1 if co == '-' else co
        co = float(co)
        coeff[1] = coeff.get(1, 0) + co
    
    for co, _, pow in powers:
        co = co.replace(' ', '').strip()
        co = 1 if len(co) == 0 else co
        co = -1 if co == '-' else co
        co = float(co)
        pow = int(pow)
        coeff[pow] = coeff.get(pow, 0) + co
    
    deg = max(coeff.keys())
    out = [coeff.get(k, 0) for k in range(deg + 1)]
    
    return out