def wrap(x): if isinstance(x, bool): return true if x else false if isinstance(x, int): return numbers.Integer(x) if isinstance(x, rbigint): return numbers.BigInteger(x) if isinstance(x, float): return numbers.Float(x) if isinstance(x, unicode): return String(x) if isinstance(x, py_str): return String(unicode(x)) if isinstance(x, Object): return x if x is None: return nil if not we_are_translated(): print x, type(x) affirm(False, u"Bad wrap")
def _floor(x): affirm(isinstance(x, numbers.Float), u"floor expects a Float") return numbers.Integer(int(x.float_val()))