[issue18335] Add textwrap.dedent, .indent, as str methods.

Nick Coghlan report at bugs.python.org
Mon Jul 1 10:35:11 CEST 2013


Nick Coghlan added the comment:

It turns out there's one slight wrinkle in this grand plan: it won't work for docstrings without some additional tweaking to allow for method calls in the docstring detection.

>>> def f():
...     """example""".lower()
... 
>>> print(f.__doc__)
None
>>> import dis
>>> dis.dis(f)
  2           0 LOAD_CONST               1 ('example') 
              3 LOAD_ATTR                0 (lower) 
              6 CALL_FUNCTION            0 (0 positional, 0 keyword pair) 
              9 POP_TOP              
             10 LOAD_CONST               0 (None) 
             13 RETURN_VALUE

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18335>
_______________________________________


More information about the Python-bugs-list mailing list