Elegant hack or gross hack? TextWrapper and escape codes
Peter Otten
__peter__ at web.de
Thu May 28 04:14:28 EDT 2020
Chris Angelico wrote:
> On Thu, May 28, 2020 at 5:54 PM Peter Otten <__peter__ at web.de> wrote:
>> But at least now you have two -- elegant or gross -- hacks to choose from
>> ;)
>>
>
> Yeah, I thought of this originally as a challenge in redefining the
> concept of "length". But the trouble is that it might not always be
> the len() function that figures out the length - there might be a
> regex with a size threshold or any number of other things that
> effectively think about the length of the string.
So start with your hack, and if the pain becomes too hard do it right,
perhaps making TextWrapper a bit more intelligible in the process.
More information about the Python-list
mailing list