Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-95065: Argument Clinic: Pretty-print long C strings in generated code#107712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-95065: Argument Clinic: Pretty-print long C strings in generated code#107712
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Could nottextwrap.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.
Perhaps. I experimented a little bit with |
erlend-aasland commentedAug 7, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
A simpler approach could be to use wrapped=textwrap.wrap(...)forlineinwrapped:# add indent, add quoted line, add suffix and newline |
|
b2d7f3a to68c1b1eCompare
Unfortunately, not so simple. |
For example, we don't want the suffix to be applied to the last line. |
I think3de2378 should do the trick. |
| width:int=72, | ||
| suffix:str='', | ||
| initial_indent:int=0, | ||
| subsequent_indent:int=4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It seems all call sites specify a value for thesubsequent_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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hm, perhaps.
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>
Thank you for the reviews! |
Uh oh!
There was an error while loading.Please reload this page.