[Python-ideas] New explicit methods to trim strings
Chris Angelico
rosuav at gmail.com
Mon Mar 25 06:58:52 EDT 2019
On Mon, Mar 25, 2019 at 9:24 PM Jonathan Fine <jfine2358 at gmail.com> wrote:
>
> Instead of naming these operations, we could use '+' and '-', with semantics:
>
> # Set the values of the variables.
> >>> a = 'hello '
> >>> b = 'world'
> >>> c = 'hello world'
>
> # Some values between the variables.
> >>> a + b == c
> True
> >>> a == c - b
> True
> >>> b = -a + c
> True
>
The semantics are rather underdefined here. What *exactly* does string
subtraction do? Is a-b equivalent to a.replace(b, "") or something
else? Also.... you imply that it's possible to negate a string and
then add it, but... what does a negative string look like? *confused*
ChrisA
More information about the Python-ideas
mailing list