Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is the `hex(31)` conversion deprecated or not?

Hello, Sage Community!

A few months ago, when compiling Sage code to convert the decimal 31 to hexadecimal notation, I got a deprecation warning message telling me not to use hex(31), but 31.hex(). That was with SageMath 8.x (possibly 8.8 or 8.9; I don't remember exactly).

However, right now (version 9.1), when I run the command hex(31), it returns ``0x1f (the decimal representation of decimal 31), without any deprecation warning.

As the title says: Is the hex(31) conversion deprecated or not?

Other problem: hex(31) return 0x1f, while 31.hex() returns 1f

Thanks in advance for your answers!

Related: https://ask.sagemath.org/question/51951/is-the-011-notation-for-octal-11-deprecated-or-not/