[Python-ideas] Debugging: some problems and possible solutions

Jonathan Fine jfine2358 at gmail.com
Wed Oct 3 10:51:43 EDT 2018


This thread is about debugging. I suggest we start by collecting
problems and possible solutions. And that after about a week of that,
we start discussing what we've gathered.

We already have a problem and possible solution, provided by Eric
Smith and Larry Hastings.

<begin>
TITLE: f-string "debug" conversion
URL: https://mail.python.org/pipermail/python-ideas/2018-October/053956.html
PROBLEM
Writing
    print('value = ', value)
is tedious, particularly for more complicated expressions, such as
    print('big_array[5:20] =', big_array[5:20])

POSSIBLE SOLUTION

For f-strings, we add a !d conversion operator, which produces the
text of an expression followed by its value. Thus, the two previous
examples can be written more concisely as
    print(f'{value !d}')
    print(f'{big_array[5:20] !d}')
</end>

I suggest for the moment that we just gather problem-solution pairs,
much as above. I think they'll be between 5 and 15 such pairs. I'll
post one to the current discussion thread in an hour or so.

And that after about a week, we move to discussing what we have.
Finally, many thanks to Eric and Larry for their useful contribution
to the important problem of debugging.

-- 
Jonathan


More information about the Python-ideas mailing list