[Python-ideas] f-string "debug" conversion

Ivan Levkivskyi levkivskyi at gmail.com
Wed Oct 3 07:10:11 EDT 2018


On Wed, 3 Oct 2018 at 11:45, Eric V. Smith <eric at trueblade.com> wrote:

> On 10/3/2018 3:54 AM, Steven D'Aprano wrote:
> > On Tue, Oct 02, 2018 at 08:27:03PM -0400, Eric V. Smith wrote:
> >
> >> 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!),
> >
> > I SO WANT THIS AS A GENERAL FEATURE, not just for f-strings, it hurts.
> >
> > Actually what I want is an executable object (a function?) which has the
> > AST and text of the expression attached. If putting this into f-strings
> > is a first step towards getting this thunk-like thing, then I don't
> > need to read any further, I'm +10000 :-)
>
> I feel your pain, but we're a long way from that.
>

Maybe we are actually not so far? PEP 563 added functionality for
transforming expressions to strings, maybe it can be reused for this
purpose?
I would love to have this since in my experience I mostly print some
(relatively complex) expressions.

--
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181003/92bded6b/attachment.html>


More information about the Python-ideas mailing list