You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The usability of multi-line string literals could be greatly improved if there was a way to have leading and trailing newlines stripped and common indent removed, similar to how Java textblocks work. Python doesn't do this, but offers functions such as inspect.cleandoc and textwrap.dedent that perform such postprocessing. It would be very convenient for Starlark strings to provide such a function as a member function.
Before:
deff():
return"""\foobarbaz"""
After:
deff():
return""" foo bar baz """.dedented()
Implementations could detect obvious calls to detended() and optimize them so that there is a single dedented string instance.
The text was updated successfully, but these errors were encountered:
The usability of multi-line string literals could be greatly improved if there was a way to have leading and trailing newlines stripped and common indent removed, similar to how Java textblocks work. Python doesn't do this, but offers functions such as
inspect.cleandoc
andtextwrap.dedent
that perform such postprocessing. It would be very convenient for Starlark strings to provide such a function as a member function.Before:
After:
Implementations could detect obvious calls to
detended()
and optimize them so that there is a single dedented string instance.The text was updated successfully, but these errors were encountered: