[ python-Feature Requests-1237680 ] add dedent() string method

SourceForge.net noreply at sourceforge.net
Wed Jul 13 23:53:47 CEST 2005


Feature Requests item #1237680, was opened at 2005-07-13 11:48
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1237680&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Reinhold Birkenfeld (birkenfeld)
Assigned to: Nobody/Anonymous (nobody)
Summary: add dedent() string method

Initial Comment:
textwrap.dedent() is very useful for in-code multi-line
string literals. However, as it is "hidden" in a module
it does not really fit in, people don't use it and
instead propose new string literal syntax for "dedented".

str.dedent with an efficient C implementation would
solve this.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-07-13 16:53

Message:
Logged In: YES 
user_id=80475

-1 

* Being a top level function in a module doesn't count as
hidden.  This is no more hidden than collections.deque,
glob.glob, or re.sub.

* The API requirements are looser in a textwrap context. 
For a string method, there would need to be a universally
useful decision about how to handle mixed spaces and tabs
and whether the first line of a triple-quoted string would
be handled differently.  Am not sure if universal newlines
present any additional issues.

* The world-view of the string module is character oriented,
not line oriented.  A dedent method() is not a perfect fit.

* While the topic comes up every few years, in general,
there is no user demand for this.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1237680&group_id=5470


More information about the Python-bugs-list mailing list