(coeffs, opt)
return domain, result
Handle simple domains, e.g.: ZZ, QQ, RR and algebraic domains.
Handle simple domains, e.g.: ZZ, QQ, RR and algebraic domains.
Handle simple domains e . g . : ZZ QQ RR and algebraic domains .
def _construct_simple(coeffs, opt):
    """Handle simple domains, e.g.: ZZ, QQ, RR and algebraic domains. """
    result, rationals, reals, algebraics = {}, False, False, False

    if opt.extension is True:
        is_algebraic = lambda coeff: ask(Q.algebraic(coeff))
    else:
        is_algebraic = lambda coeff: False

    # XXX: add support for a + b*I coefficients
    for coeff in coeffs:
        if coeff.is_Rational:
            if not coeff.is_Integer:
                rationals = True
        elif coeff.is_Float:
            if not algebraics:
                reals = True
            else:
                # there are both reals and algebraics -> EX
                return False
        elif is_algebraic(coeff):
            if not reals:
                algebraics = True
            else:
                # there are both algebraics and reals -> EX
                return False
        else:
            # this is a composite domain, e.g. ZZ[X], EX
            return None

    if algebraics:
        domain, result = _construct_algebraic(coeffs, opt)
    else:
        if reals:
            domain = RR
        else:
            if opt.field or rationals:
                domain = QQ
            else:
                domain = ZZ

        result = []

        for coeff in coeffs:
            result.append(domain.from_sympy(coeff))

    return domain, result
def _construct_simple ( coeffs , opt ) : result , rationals , reals , algebraics = { } , False , False , False if opt . extension is True : is_algebraic = lambda coeff : ask ( Q . algebraic ( coeff ) ) else : is_algebraic = lambda coeff : False # XXX: add support for a + b*I coefficients for coeff in coeffs : if coeff . is_Rational : if not coeff . is_Integer : rationals = True elif coeff . is_Float : if not algebraics : reals = True else : # there are both reals and algebraics -> EX return False elif is_algebraic ( coeff ) : if not reals : algebraics = True else : # there are both algebraics and reals -> EX return False else : # this is a composite domain, e.g. ZZ[X], EX return None if algebraics : domain , result = _construct_algebraic ( coeffs , opt ) else : if reals : domain = RR else : if opt . field or rationals : domain = QQ else : domain = ZZ result = [ ] for coeff in coeffs : result . append ( domain . from_sympy ( coeff ) ) return domain , result