On Tue, Mar 26, 2019 at 7:04 AM fhsxfhsx <fhsxf...@126.com> wrote: > > Just as to your example, you can try `textwrap.dedent` > Procedural removal is not cool, because it does not know the parent indentation of the statement that contains the text block, thus it can't resolve automatically string indents that were intentionally indented to include extra space.
E.g. this, where "s=" line is already inside an indented block: s = """ Hello world""" Say I use 1 tab for 1 indent - what I want here is to remove 1 tab from each string line AND 1 tab that belongs to code formatting (current indent of the "s=" line). And if you try to guess it from the string itself - it is impossible to resolve all cases, because you still need some criteria - for example you could use criteria "minimal indent inside the string is the indent" but this will again fail if you want extra shift on same level inside the string. E.g. this: s = """ Hello world""" Here I do not want to remove all indents but only as in above - only 1 level inside string and 1 from parent line. Do you get it? So in other words if I want my string blocks aligned within containing blocks, it becomes impossible to resolve all un-indenting cases automatically. Mikhail _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/