Ticket #12734: trac_12734-point_scheme.2.patch

File trac_12734-point_scheme.2.patch, 2.0 KB (added by AlexGhitza, 9 years ago)
  • sage/schemes/generic/spec.py

    # HG changeset patch
    # User Alexandru Ghitza <aghitza@alum.mit.edu>
    # Date 1374735191 -36000
    #      Thu Jul 25 16:53:11 2013 +1000
    # Node ID fc682a627ecf4c365ca1efeb5a3c545e156e1f11
    # Parent  72bcd2f7a7b59ca30b86d3a1b409c54672d73afb
    trac 12734: make call syntax of Spec more consistent
    
    diff --git a/sage/schemes/generic/spec.py b/sage/schemes/generic/spec.py
    a b  
    226226        """
    227227        Call syntax for Spec.
    228228       
    229         INPUT:
     229        INPUT/OUTPUT:
    230230
    231         - ``x`` -- a prime ideal of the coordinate ring, or an element
    232           (or list of elements) of the coordinate ring which generates
    233           a prime ideal.
     231        The argument ``x`` must be one of the following:
    234232
    235         OUTPUT:
     233        - a prime ideal of the coordinate ring; the output will
     234          be the corresponding point of X
    236235       
    237         A point of this Spec.
     236        - an element (or list of elements) of the coordinate ring
     237          which generates a prime ideal; the output will be the
     238          corresponding point of X
     239
     240        - a ring or a scheme S; the output will be the set X(S) of
     241          S-valued points on X
    238242
    239243        EXAMPLES::
    240244
     
    252256            Point on Spectrum of Multivariate Polynomial Ring
    253257            in x, y, z over Rational Field defined by the Ideal (x, y, z)
    254258            of Multivariate Polynomial Ring in x, y, z over Rational Field
     259
     260        This indicates the fix of :trac:`12734`::
     261            sage: S = Spec(ZZ)
     262            sage: S(ZZ)
     263            Set of rational points of Spectrum of Integer Ring
     264            sage: S(S)
     265            Set of rational points of Spectrum of Integer Ring
    255266        """
     267        if is_CommutativeRing(x):
     268            return self.point_homset(x)
     269        from sage.schemes.all import is_Scheme
     270        if is_Scheme(x):
     271            return x.Hom(self)
     272
    256273        return SchemeTopologicalPoint_prime_ideal(self, x)
    257274
    258275    def _an_element_(self):