File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -4166,14 +4166,22 @@ cdef class FreeModuleElement(Vector): # abstract base class
4166
4166
sage: v.concatenate(w).parent()
4167
4167
Ambient free module of rank 5 over the principal ideal domain Integer Ring
4168
4168
4169
- The method fails when the vectors aren' t defined over the same ring::
4169
+ The method fails when the inputs aren' t both vectors, or the vectors
4170
+ aren' t defined over the same ring::
4170
4171
4172
+ sage: w2 = polygen(QQ)^ 4 + 5
4173
+ sage: v.concatenate(w2)
4174
+ Traceback (most recent call last):
4175
+ ...
4176
+ TypeError : can only concatenate two vectors
4171
4177
sage: w2 = vector(QQ, [4 , 5 ])
4172
4178
sage: v.concatenate(w2)
4173
4179
Traceback (most recent call last):
4174
4180
...
4175
4181
ValueError : can only concatenate vectors over the same base ring
4176
4182
"""
4183
+ if not isinstance(other, FreeModuleElement):
4184
+ raise TypeError('can only concatenate two vectors')
4177
4185
R = self.parent().base_ring()
4178
4186
if other.parent().base_ring() != R:
4179
4187
raise ValueError('can only concatenate vectors over the same base ring')
You can’t perform that action at this time.
0 commit comments