Ask Your Question

Revision history [back]

This is because Sage uses a preparser so that when you type:


Sage preparser replaces it with

a = Integer(2)

before sending it to Pytohn, so that a is a genuine integer, not a bare int.

The deque function does not support the Sage Integers, so you have to provide it a Python int. You can either do:

  • tell the preparser not to touch the 500 in the definition of history_len :

    sage: history_len = 500r
  • convert the Sage Integer back to a Python int:

    history_len = int(500)
  • deactivate the preparser on the whole worksheet, by adding the following cell at the beginning of the worksheet: