[Python-ideas] f-string "debug" conversion
Jonathan Fine
jfine2358 at gmail.com
Wed Oct 3 05:29:29 EDT 2018
Hi Eric
Summary: This email is mainly about process. One discussion thread or
several. I think the decision is yours.
You wrote suggesting an enhancement for debugging:
> Here’s the idea: for f-strings, we add a !d conversion operator, which
> is superficially similar to !s, !r, and !a. The meaning of !d is:
> produce the text of the expression (not its value!), followed by an
> equal sign, followed by the repr of the value of the expression.
You gave as one of several examples that given
value = 10
the expression
f'{value!d}'
evaluates to
'value=10'
which can then be printed or logged.
I thank you and Larry Hastings for coming up with and exploring this idea.
Here's my personal opinion, which does not count for much. I like the
output and ease of use. I have doubts about the implementation, and
how it might work with other things. And also, I'd like the change to
go through the PEP process.
The present discussion thread is spreading into other areas, such as
what constitutes the Python language specification. I'd like to
contribute to a broader discussion, of how we can improve the
debugging experience. But I feel uncomfortable doing so in a
discussion thread that started with your admirably clear focus.
Briefly, Eric, would you like the general discussion of improving
debugging to take place in this thread, or in another.
Finally, if I may I thank you and Larry for your work on this
important topic, and for starting this useful discussion.
--
Jonathan
More information about the Python-ideas
mailing list