(e)
Convert from a sympy scalar to a Python scalar.
Convert from a sympy scalar to a Python scalar.
Convert from a sympy scalar to a Python scalar .
def _sympy_to_scalar(e):
    """Convert from a sympy scalar to a Python scalar."""
    if isinstance(e, Expr):
        if e.is_Integer:
            return int(e)
        elif e.is_Float:
            return float(e)
        elif e.is_Rational:
            return float(e)
        elif e.is_Number or e.is_NumberSymbol or e == I:
            return complex(e)
    raise TypeError('Expected number, got: %r' % e)
def _sympy_to_scalar ( e ) : if isinstance ( e , Expr ) : if e . is_Integer : return int ( e ) elif e . is_Float : return float ( e ) elif e . is_Rational : return float ( e ) elif e . is_Number or e . is_NumberSymbol or e == I : return complex ( e ) raise TypeError ( 'Expected number, got: %r' % e )