Author gregory.p.smith
Recipients gregory.p.smith
Date 2019-05-30.18:00:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559239200.57.0.0816589870282.issue37102@roundup.psfhosted.org>
In-reply-to
Content
I'm spawning this issue of as a separate feature from https://bugs.python.org/issue36906 (adding string dedent method and an optimization to do it at compile timer on constants).

It'd be great if docstrings were given a similar treatment.  Right now we carry the whitespace burden within the str constants for __doc__ stored in all code objects in the process.  This adds up.

This is not _quite_ the same as calling textwrap.dedent() or the upcoming str.dedent method on them at compile time.  We need to special case the first line of docstrings.  inspect.getdoc() is our library function that does this for us today.

Change of breaking things with this change?  not impossible, but extremely minor.  Something using docstrings as data _and_ depending on leading indentation whitespace preservation would not like this.  I am not aware of anything that would ever do that.
History
Date User Action Args
2019-05-30 18:00:00gregory.p.smithsetrecipients: + gregory.p.smith
2019-05-30 18:00:00gregory.p.smithsetmessageid: <1559239200.57.0.0816589870282.issue37102@roundup.psfhosted.org>
2019-05-30 18:00:00gregory.p.smithlinkissue37102 messages
2019-05-30 18:00:00gregory.p.smithcreate