Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
On Thu, May 02, 2019 at 11:40:45AM +0000, Eric V. Smith wrote: > > New submission from Eric V. Smith <e...@trueblade.com>: > > I originally propsed this here: > https://mail.python.org/pipermail/python-ideas/2018-October/053956.html, and > there has also been some discussion on discourse. > > The proposal is to add a !d "type conversion" to f-strings, to make for > simpler "print-based debugging". The idea is that !d would be like !r, etc., > except that the resulting string would be: > > - the text of the expression, followed by > - an equal sign, followed by > - the value of the expression I don't want to see this added as a special case to f-strings. I think there are enough use-cases for having access to expressions, complete with source code, as first-class values to make this a general feature of the language and not baked into f-strings. I have a proto-PEP discussing this. > I have a patch almost ready. Please don't limit this useful feature to f-strings. "Debugging strings" only scratches the surface of what this could be useful for. ---------- nosy: +steven.daprano _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36774> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com