Uh oh!
There was an error while loading. Please reload this page.
gh-95065: Argument Clinic: Pretty-print long C strings in generated code - #107712
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Could not textwrap.wrap(replace_whitespace=False, drop_whitespace=False) be used here?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland
commented
Aug 7, 2023
Perhaps. I experimented a little bit with |
A simpler approach could be to use wrapped=textwrap.wrap(...)
forlineinwrapped:
# add indent, add quoted line, add suffix and newline |
serhiy-storchaka
commented
Aug 7, 2023
|
b2d7f3a to
68c1b1eCompareerlend-aasland
commented
Aug 7, 2023
Unfortunately, not so simple. |
erlend-aasland
commented
Aug 7, 2023
For example, we don't want the suffix to be applied to the last line. |
erlend-aasland
commented
Aug 7, 2023
I think 3de2378 should do the trick. |
| width: int = 72, | ||
| suffix: str = '', | ||
| initial_indent: int = 0, | ||
| subsequent_indent: int = 4 |
There was a problem hiding this comment.
It seems all call sites specify a value for the subsequent_indent parameter. Maybe it should be required, instead of optional?
| width: int=72, | |
| suffix: str='', | |
| initial_indent: int=0, | |
| subsequent_indent: int=4 | |
| subsequent_indent: int, | |
| width: int=72, | |
| suffix: str='', | |
| initial_indent: int=0, |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
erlend-aasland
commented
Aug 7, 2023
Thank you for the reviews! |
Uh oh!
There was an error while loading. Please reload this page.