Revision history [back]

What you can do is a dictionary:

sage: d = dict()
sage: for i in range(2^3):
....:     d[F.fetch_int(i)] = i

sage: d
{0: 0, 1: 1, x: 2, x + 1: 3, x^2: 4, x^2 + 1: 5, x^2 + x: 6, x^2 + x + 1: 7}
sage: d[x^2]
4
sage: d[x+1]
3