def _coerce_map_from_(self, S): """ Return a coerce map from ``S``. EXAMPLES:: sage: f = QQ.coerce_map_from(ZZ); f # indirect doctest Natural morphism: From: Integer Ring To: Rational Field sage: f(3) 3 sage: f(3^99) - 3^99 0 sage: f = QQ.coerce_map_from(int); f # indirect doctest Native morphism: From: Set of Python objects of type 'int' To: Rational Field sage: f(44) 44 :: sage: QQ.coerce_map_from(long) # indirect doctest Composite map: From: Set of Python objects of type 'long' To: Rational Field Defn: Native morphism: From: Set of Python objects of type 'long' To: Integer Ring then Natural morphism: From: Integer Ring To: Rational Field """ global ZZ if ZZ is None: import integer_ring ZZ = integer_ring.ZZ if S is ZZ: return rational.Z_to_Q() elif S is int: return rational.int_to_Q() elif ZZ.has_coerce_map_from(S): return rational.Z_to_Q() * ZZ.coerce_map_from(S)