Serhiy Storchaka added the comment: I think the current behavior is useful, but undocumented. Otherwise a blank line starting with unmatched whitespaces (e.g. " foo\n\t\n bar") would block deindenting.
This also matches the behavior of Python parser which ignores all whitespaces
in blank lines.
>>> exec('if 1:\n\tpass\n pass\n')
>>>
>>>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 3
pass
^
IndentationError: unindent does not match any outer indentation level
>>> exec('if 1:\n\t\n pass\n')
>>>
>>>
>>>
Added Antoine and Nick as yet two experts of the textwrap module.
----------
nosy: +ncoghlan, pitrou, serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30754>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
