Implementing string unary operators
12 Oct
2021
12 Oct
'21
11:50 p.m.
I posted a previous thread about overloading the unary `+` operator in strings with `ord`, and that expanded to more than just the unary `+` operator. So I'm saying now, there should be these implementations:
+string - `int(string, 10)` (or just `int(string)`) -string - `int(string, 8)` ~string - `int(string, 16)`
Or:
+string - `string.lstrip()` -string - `string.rstrip()` ~string - `string.strip()`
If anyone has better ideas, they can post it here.
891
Age (days ago)
899
Last active (days ago)
41 comments
15 participants
participants (15)
-
2QdxY4RzWzUUiLuE@potatochowder.com
-
Abdur-Rahmaan Janhangeer
-
Chris Angelico
-
Guido van Rossum
-
Jelle Zijlstra
-
Jeremiah Vivian
-
Marc-Andre Lemburg
-
MarylandBall Productions
-
MRAB
-
Paul Moore
-
Peter Ludemann
-
Ricky Teachey
-
Serhiy Storchaka
-
Stephen J. Turnbull
-
Steven D'Aprano