Changeset 16770:84f81aa993a4


Ignore:
Timestamp:
01/18/10 05:43:48 (3 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

Trac #5646: Vectors over CDF allow a coercion from scalars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/modules/vector_double_dense.pyx

    r16698 r16770  
    169169            sage: vector(RDF, 4, range(4)) 
    170170            (0.0, 1.0, 2.0, 3.0) 
     171             
     172            sage: V = RDF^2 
     173            sage: V._element_class(V, 5) 
     174            Traceback (most recent call last): 
     175            ... 
     176            TypeError: entries must be a list or 0 
     177            sage: V._element_class(V, 0) 
     178            (0.0, 0.0) 
    171179        """ 
    172180        cdef Py_ssize_t i,j 
     
    195203                    raise TypeError("cannot coerce entry to type %s"%self._python_dtype) 
    196204                if z != 0: 
     205                    raise TypeError("entries must be a list or 0") 
     206                else: 
     207                    # Set all entries to z=0. 
    197208                    for i from 0<=i<self._degree: 
    198209                        self.set_unsafe(i,z) 
Note: See TracChangeset for help on using the changeset viewer.