Ask Your Question

# Revision history [back]

### Cannot convert int to sage.rings.integer.Integer

I created a minimal example in the file bad.py

from sage.all import *

j = 0
m = matrix(3,3)
m.insert_row(j, [1,1,1])


Then from sage:

sage: load bad.py
TypeError: Cannot convert int to sage.rings.integer.Integer


I think I can see an easy workaround, I can wrap all the 1's in Integer() (or change the name of the file to .sage so the preparser does it), but why is that necessary? Is this a bug? Why would sage not be able to convert int to Integer? Isn't that a pretty obvious conversion?