Closed sherry30 closed 1 year ago
I think this is by design- when inspecting variables, you see the actual content of the variable, it should not interpret the contents of the variable as a special escape code
@roblourens I just stumbled upon this issue. Can we reconsider?
I think that rationale makes sense if you had s = "\033[1;32m This text is Bright Green \n"
and then looked at s: You are inspecting the raw data, so no interpretation should happen. But in this case the debugger is going through __repr__()
. As soon as you have to use repr, you no longer have any hope of seeing exactly "the actual content of the variable", but instead a representation useful for debugging. If you want to see the actual content, then you have to inspect the individual members of the object, possibly in the debugger variable explorer.
I would expect this behavior:
This is the behavior that jupyter has, and (at least I) expected.
Steps to Reproduce:
If you have any ANSI escape sequences in a custom class, they don't get printed directly unless print statement is used.
create a custom class in a new python file:
Put a breaker at
print(x)
statement and Debug this and open up the debug console.type
x
and press Enter, it will print[1;32m This text is Bright Green
. If you doprint(x)
then it prints correctly in green color.This works fine in Pycharm's debug console.