OKB (not okblacke) wrote:
> > (You dedent common leading tabs, except if preceded by common leading
> > spaces (?)).
>
> There cannot be common leading tabs if they are preceded by
> anything. If they were preceded by something, they wouldn't be
> "leading".
Right, but 'common leading w
Frederic Rentsch wrote:
> (You dedent common leading tabs, except if preceded by common leading
> spaces (?)).
There cannot be common leading tabs if they are preceded by
anything. If they were preceded by something, they wouldn't be
"leading".
--
--OKB (not okblacke)
Brendan Barnwell
Tom Plunket wrote:
> Frederic Rentsch wrote:
>
>
>> Your rules seem incomplete.
>>
>
> Not my rules, the stated documentation for dedent. "My" understanding
> of them may not be equivalent to yours, however.
It's not about understanding, It's about the objective. Let us consider
the diffe
Frederic Rentsch wrote:
> Your rules seem incomplete.
Not my rules, the stated documentation for dedent. "My" understanding
of them may not be equivalent to yours, however.
> What if common tabs remain after stripping common white space?
What if we just go with, "[r]emove any whitespace than c
Tom Plunket wrote:
> Frederic Rentsch wrote:
>
>
>> It this works, good for you. I can't say I understand your objective.
>> (You dedent common leading tabs, except if preceded by common leading
>> spaces (?)).
>>
>
> I dedent common leading whitespace, and tabs aren't equivalent to
> spa
Frederic Rentsch wrote:
> It this works, good for you. I can't say I understand your objective.
> (You dedent common leading tabs, except if preceded by common leading
> spaces (?)).
I dedent common leading whitespace, and tabs aren't equivalent to
spaces.
E.g. if some text is indented exclusi
Tom Plunket wrote:
> Frederic Rentsch wrote:
>
>
>> Following a call to dedent () it shouldn't be hard to translate leading
>> groups of so many spaces back to tabs.
>>
>
> Sure, but the point is more that I don't think it's valid to change to
> tabs in the first place.
>
> E.g.:
>
> inpu
Frederic Rentsch wrote:
> Following a call to dedent () it shouldn't be hard to translate leading
> groups of so many spaces back to tabs.
Sure, but the point is more that I don't think it's valid to change to
tabs in the first place.
E.g.:
input = ' ' + '\t' + 'hello\n' +
'\t' + 'wo
Tom Plunket wrote:
> Frederic Rentsch wrote:
>
>
>>> Well, there is that small problem that there are leading tabs that I
>>> want stripped. I guess I could manually replace all tabs with eight
>>> spaces (as opposed to 'correct' tab stops), and then replace them when
>>> done, but it's probabl
Frederic Rentsch wrote:
> > Well, there is that small problem that there are leading tabs that I
> > want stripped. I guess I could manually replace all tabs with eight
> > spaces (as opposed to 'correct' tab stops), and then replace them when
> > done, but it's probably just as easy to write a n
Peter Otten wrote:
> > I guess I could manually replace all tabs with eight
> > spaces (as opposed to 'correct' tab stops), and then replace them when
> > done, but it's probably just as easy to write a non-destructive dedent.
>
> You mean, as easy as
>
> >>> "\talpha\tbeta\t".expandtabs()
> '
Tom Plunket wrote:
> CakeProphet wrote:
>
>
>> Hmmm... a quick fix might be to temporarily replace all tab characters
>> with another, relatively unused control character.
>>
>> MyString = MyString.replace("\t", chr(1))
>> MyString = textwrap.dedent(MyString)
>> MyString = MyString.replace(chr(1
Tom Plunket wrote:
> I guess I could manually replace all tabs with eight
> spaces (as opposed to 'correct' tab stops), and then replace them when
> done, but it's probably just as easy to write a non-destructive dedent.
You mean, as easy as
>>> "\talpha\tbeta\t".expandtabs()
'alpha be
CakeProphet wrote:
> Hmmm... a quick fix might be to temporarily replace all tab characters
> with another, relatively unused control character.
>
> MyString = MyString.replace("\t", chr(1))
> MyString = textwrap.dedent(MyString)
> MyString = MyString.replace(chr(1), "\t")
>
> Of course... this
Hmmm... a quick fix might be to temporarily replace all tab characters
with another, relatively unused control character.
MyString = MyString.replace("\t", chr(1))
MyString = textwrap.dedent(MyString)
MyString = MyString.replace(chr(1), "\t")
Of course... this isn't exactly safe, but it's not goi
The documentation for dedent says, "Remove any whitespace than can be
uniformly removed from the left of every line in `text`", yet I'm
finding that it's also modifying the '\t' characters, which is highly
undesirable in my application. Is there any way to stop it from doing
this, or alternatively
16 matches
Mail list logo