[Python-ideas] New explicit methods to trim strings
jfine2358 at gmail.com
Mon Mar 25 08:01:21 EDT 2019
Chris Angelico asked: what does a negative string look like?
This is a very good question. It looks a bit like a negative number.
>>> 2 + 2
>>> len('aa' + 'bb')
-2 # Odd, I must confess.
>>> 5 + (-1)
>>> 'hello' + (-'o')
>>> len('hello' + (-'o'))
Grade school: How can I possible have -3 apples in my bag.
University: How can I possibly be overdrawn in my bank account.
Negative strings are similar to negative numbers except:
For numbers a + b == b + a
For strings a + b != b + a
It is the non-commuting that make negative strings difficult. This is a bit
like computer programming. It's not enough to have the correct lines of
code (or notes). They also have to be put in the right order.
I hope this helps. I do this sort of math all the time, and enjoy it. Your
experience may be different.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas