Re: Idea: Tagged strings in python

Dec. 22, 2022
4:21 p.m.
On 19/12/2022 03:23, David Mertz, Ph.D. wrote:
Yes, you have to do some more work with the methods you need to use: class mystr(str): def method(self): return 1234 def upper(self): return mystr(str(self).upper()) s = mystr("hello") print(s.method()) # prints 1234 print(s.upper()) # prints HELLO print(s.upper().method()) # prints 1234 Best wishes Rob Cliffe
795
Age (days ago)
795
Last active (days ago)
0 comments
1 participants
participants (1)
-
Rob Cliffe