Has attribute “hex” been removed to “Integer” type?

asked 2020-03-30 05:18:26 +0200

Nashtare gravatar image

I wanted to check out a github implementation, but after launching their script I got the error:

AttributeError: 'sage.rings.integer.Integer' object has no attribute 'hex'

I verified the code, checked on doc sagemath that the attribute hex was existing, I even removed sagemath, reinstalled it, checked for upgrades, without anything changing. I currently have SageMath version 8.1, Release Date: 2017-12-07.

When I am creating an integer on the sage terminal and looking for hex, I can see every attributes listed on the sagemath Integer documentation, except the wanted hex().

I couldn't find any information online about a potential withdrawal of this attribute in recent versions of sagemath, and granted that the github code I'm interested in has been updated recently, I assume having a bug here that I don't know how to deal with...

edit retag flag offensive close merge delete


Which github repository are you using ? Is it compatible with python 3 ? You should rather use a newer version of sage, as sage 9.0 has switched to python3. And the following still works:

sage: hex(int(6))
sage: hex(ZZ(6))
FrédéricC gravatar imageFrédéricC ( 2020-03-31 20:11:16 +0200 )edit