[Python-ideas] New explicit methods to trim strings
jfine2358 at gmail.com
Mon Mar 25 08:19:35 EDT 2019
More on negative strings. They are easier, if they only use one character.
Red Queen: What's one and one and one and one and one and one and one and
one and one and one and one and one and one?
Alice: I don't know. I lost count.
Red Queen: She can't do arithmetic.
3 --> 'aaa'
2 --> 'aa'
1 --> 'a'
0 --> ''
-1 -> -'a'
-2 -> -'aa'
-3 -> -'aaa'
Negative strings are easier if we can rearrange the order of the letters.
>>> ''.join(sorted('forty five'))
>>> ''.join(sorted('over fifty'))
Instead of counting (positively and negatively) just the letter 'a', we do
the whole alphabet.
By when order matters, we get an enormous free group, which Python
programmers by accident see.
I hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas