[Python-Dev] Re: Multiline string constants, include in the standard library?

M.-A. Lemburg mal@lemburg.com
Mon, 29 Jul 2002 11:44:37 +0200


Ville Vainio wrote:
> M.-A. Lemburg wrote:
> 
>> I think everybody has their own way of formatting multi-line
>> strings and/or comments. There's no one-fits-all strategy.
> 
> 
> Yep, but having a standard solution available to a one, very sensible 
> strategy would be nice.
> 
>>
>> So instead of trying to find a compromise, why don't you write up
>> a flexible helper function for the new textwrap module ?
> 
> 
> I don't think there is all that much implementation to do: 
> inspect.getdoc() already has an implementation that seems to do the 
> right thing, it's just that the stripping is embedded into the getdoc 
> function, instead of having it available as a seperate function. 
> textwrap might be a good place to put it, considering that the string 
> module is going away - even if no actual wrapping takes place.

Oh, I think it is worthwhile applying some optional wrapping
for overly long doc-strings as well. But there you go again:
people simply don't match up when it comes to text formatting.
It's all a matter of taste and style (e.g. in the US it is
very common to indent the first line of a paragraph while in
most of Europe is not).

How about starting with a simple textwrap.dedent() API and then
moving on towards the full monty textwrap.reformat() API with tons
of options ?!

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/