[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-16 Thread Eric V. Smith
Eric V. Smith added the comment: I suggest you discuss this on python-ideas, since we'll need to reach consensus there, first. -- components: +Interpreter Core -IO, Library (Lib) ___ Python tracker

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-16 Thread Charles Machalow
Charles Machalow added the comment: In terms of multiple parameters, I propose adding a method to control the defaults used by !p. Though the defaults would work more than well enough for basic log and print usage. -- ___ Python tracker

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-16 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Raymond that it's unlikely that this will work, as a practical matter. In addition to the other problems mentioned, there's the issue of the many parameters to control pprint. And I agree with pprint, or a replacement, needing a redesign. I think

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-16 Thread Charles Machalow
Charles Machalow added the comment: One of the key things for ppformat here is to format long spanning dicts/lists to multiple lines, that look easy to read in a log. I feel as though that feature/usefulness outweigh potential indentation weirdness. A lot of the usage would probably be towar

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: If the python-ideas discussion is fruitful, go ahead and re-open this tracker item. Personally, I don't see how this would work. The pretty printing routines rely on knowing their current level of indentation. Also, much of the "prettiness" comes from

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-15 Thread Charles Machalow
Charles Machalow added the comment: Fair enough. Didn't really know that list existed. Sent this there. Awaiting moderator approval. Thanks. -- ___ Python tracker ___ ___

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-15 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This needs discussion on python-ideas/ideas category on discourse similar to f-string debug notation. -- nosy: +eric.smith, xtreak ___ Python tracker

[issue41312] add !p to pprint.pformat() in str.format() an f-strings

2020-07-15 Thread Charles Machalow
New submission from Charles Machalow : Right now in str.format(), we have !s, !r, and !a to allow us to call str(), repr(), and ascii() respectively on the given expression. I'm proposing that we add a !p conversion to have pprint.pformat() be called to convert the given expression to a 'pret