The idea to use "-" in the context of strings may have some merrit. Not as unary minus, but as sequence operation and shorthand for str.removesuffix(x):
s = 'abc' + 'def' - 'ef' + 'gh' giving s == 'abcdgh' Removing suffixes from strings is a rather common operation. Removing prefixes is common as well, so perhaps "~" could be mapped to str.removeprefix(): s = 'abcdef' ~ 'abc' giving s == 'def' In a similar way, "/" could be mapped to str.split(), since that's probably even more common: l = 'a,b,c,d' / ',' giving: l == ['a', 'b', 'c', 'd'] Looking at the examples, I'm not sure how well this would play out in the context of just using variables, though: s = a - s s = a / c s = a ~ p By adding such operators we could potentially make math functions compatible with strings by the way of duck typing, giving some really weird results, instead of errors. Cheers, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Oct 13 2021) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/IPOPOUJ7MDOQ3QXXXZWO726725EDNJPY/ Code of Conduct: http://python.org/psf/codeofconduct/