[IPython-user] Can I configure ipython to output hex format for number?

Wong, Shin Guey shin.guey.wong@intel....
Tue Sep 23 01:46:42 CDT 2008


Hi all,

I am using ipython to do some hardware validating stuff and require to read a lot of hex number. I have a lot functions which only return decimal value but when the ipython print it out at the console, I would like it to change it to hex format when it detected the return string is number. Is this doable in ipython?

**I had done the similar thing in ruby before, because ruby support for open class, I just hack through the class and change to to_s or inspect method (which calls during output to the console) in the Numeric class, and then everything works fine. But I am not sure can I do the similar thing in Python.

Thanks in advance.

Regards,
Shin Guey




More information about the IPython-user mailing list