Ask Your Question

Revision history [back]

This is because Sage's preparser transforms the 0 in px1[0,0] into Sage's integers, while the object pxl is expecting Python's integers. The solution is to force the conversion to Python's integers via int():

pxl[int(0),int(0)]

More generally to check what Sage's preparser is doing with things you type, use the preparse command:

sage: preparse("pxl[0,0]")
'pxl[Integer(0),Integer(0)]'

(Integer() is for Sage's integers, while int() is for Python's integers).