Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
You can use f'*{n=!r:30}*' if you want to format the result of the repr. In you example the format spec is applied to both the value and the literal representation of the expression. Is it an error? I do not think this is an expected behavior. If you want to apply it to both the literal expression and its value you can use the nested f-string: f"*{f'{n=}':30}*". There is not too much more magic here: if both converter and format specifier are omitted use !r because it is a common special case. I think it is better than the other difference in the default converter used for debugging and normal formatting. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36817> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com