Ticket #11761: 11761_review.patch

File 11761_review.patch, 3.6 KB (added by jdemeyer, 10 years ago)
  • sage/misc/misc_c.pyx

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1320135932 -3600
    # Node ID 61240e91aea9415982181db4d9340dc37f7be2d5
    # Parent  ef87efd57797f2c75f24e7df62edbf80219bce38
    Cython 0.15.1 reviewer patch
    
    diff --git a/sage/misc/misc_c.pyx b/sage/misc/misc_c.pyx
    a b  
    3030    Returns a list where the i-th entry is the sum of all entries up to (and including) i.
    3131   
    3232    INPUT:
    33         L     -- the list
    34         start -- (optional) a default start value
     33
     34    - ``L`` -- the list
    3535   
    36     EXAMPLES:
     36    - ``start`` -- (optional) a default start value
     37   
     38    EXAMPLES::
     39
    3740        sage: running_total(range(5))
    3841        [0, 1, 3, 6, 10]
    3942        sage: running_total("abcdef")
    4043        ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef']
     44        sage: running_total("abcdef", start="%")
     45        ['%a', '%ab', '%abc', '%abcd', '%abcde', '%abcdef']
    4146        sage: running_total([1..10], start=100)
    4247        [101, 103, 106, 110, 115, 121, 128, 136, 145, 155]
     48        sage: running_total([])
     49        []
    4350    """
    44     cdef bint first = 1
    45     running = None
     51    running = []
     52    total = start
    4653    for x in L:
    47         if first:
    48             total = L[0] if start is None else L[0]+start
    49             running = [total]
    50             first = 0
    51             continue
    52         total += x
     54        if total is None:
     55            # This is the first entry
     56            total = x
     57        else:
     58            total += x
    5359        PyList_Append(running, total)
    5460    return running
    5561       
  • sage/rings/integer.pyx

    diff --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
    a b  
    41524152        r"""
    41534153        Returns ``True`` if ``self`` is prime.
    41544154       
     4155        INPUT:
     4156
     4157        - ``proof`` -- If False, use a strong pseudo-primality test.
     4158          If True, use a provable primality test.  If unset, use the
     4159          default arithmetic proof flag.
     4160
    41554161        .. note::
    41564162
    41574163           Integer primes are by definition *positive*! This is
    41584164           different than Magma, but the same as in PARI. See also the
    4159            :meth:`.is_irreducible` method.
     4165           :meth:`is_irreducible()` method.
    41604166
    41614167        EXAMPLES::
    41624168       
     
    41754181            sage: z.is_irreducible()
    41764182            True
    41774183
     4184        ::
     4185
     4186            sage: z = 10^80 + 129
     4187            sage: z.is_prime(proof=False)
     4188            True
     4189            sage: z.is_prime(proof=True)
     4190            True
     4191
    41784192        IMPLEMENTATION: Calls the PARI ``isprime`` function.
    41794193        """
    41804194        from sage.structure.proof.proof import get_flag
  • sage/rings/polynomial/pbori.pyx

    diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx
    a b  
    627627            sage: I.groebner_basis()
    628628            [1]
    629629        """
    630         msg = None
    631630        cdef BooleanPolynomial p
    632631        # we check for other PolyBoRi types first since this conversion
    633632        # is used by the PolyBoRi python code often
     
    752751            ...
    753752            TypeError: cannot convert polynomial z*x^2 + 5*y^3 to Boolean PolynomialRing in x, y: name z not defined
    754753        """
    755         msg = None
    756754        cdef int i
    757755
    758756        try:
  • sage/structure/coerce.pyx

    diff --git a/sage/structure/coerce.pyx b/sage/structure/coerce.pyx
    a b  
    739739            if action is not None:
    740740                return (<Action>action)._call_(x, y)
    741741       
     742        xy = None
    742743        try:
    743             xy = None
    744744            xy = self.canonical_coercion(x,y)
    745745            return PyObject_CallObject(op, xy)
    746746        except TypeError, err: