1

Is it possible to see ints (and ints that are parts of dicts, lists, and tuples, etc.) as hex values when debugging with PyDev?

More broadly, is it possible to make any given data type show up the way you want in the variable display tab?

1 Answer 1

2

The PyDev Debugger simply uses the repr() function to show the values. So if overwrite the __repr__() function than you can change how the values are printed.

I don't think there are any other options of changing the way your variables show, although you might (not sure about that) be able to get away with overwriting the repr() function itself.

Sign up to request clarification or add additional context in comments.

4 Comments

Specifically, that would be repr = lambda x: hex(x) if isinstance(x, int) else repr(x) (ignoring long). Adds quotes though. Use hex(x)[1:-1] to strip those. And keep in mind that's very very hacky.
it looks like repr is used for the flyover representation, and str is used for the Variables window. What's up with that?
@delnan: it should be noted that for that to work, you'll probably have to overwrite __builtin__.repr
@K. Brafford: Not sure about that... I rarely understand some of the strange decisions that have been made in pydev ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.