[Python-ideas] f-string "debug" conversion
Tim Peters
tim.peters at gmail.com
Thu Oct 4 18:24:10 EDT 2018
[Tim]
>
> > Note that transforming
> >
> > {EXPR!d:FMT}
> >
> > into
> >
> > EXPR={repr(EXPR):FMT}
> >
> > is actually slightly more involved than transforming it into
> >
> > EXPR={EXPR:FMT}
> >
> > so I don't buy the argument that the original idea is simpler. More
> > magical and less useful, yes ;-)
>
[Eric V. Smith]
> Actually, my proposal is to apply FMT to the entire result of
EXPR={repr(EXPR)}, not just the repr(EXPR) part. I'm not sure either is
> particularly useful.
>
So the actual transformation is from
{EXPR!d:FMT}
to
{"EXPR=" + repr(EXPR):FMT}
I expect I'll barely use "!d" at all if the format doesn't apply to the
result of EXPR, so I have no non-contrived ;-) opinion about that.
BTW, I checked, and I've never used !r, !s, or !a. So the idea that the
format could apply to a string - when EXPR itself doesn't evaluate to a
string - is simply foreign to me. I suppose it's natural to people who do
use ![rsa] all the time - if such people exist ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181004/f716ee34/attachment.html>
More information about the Python-ideas
mailing list