How to subclass str in Python
I am trying to subclass str object, and add couple of methods to it. My main purpose is to learn how to do it. Where I am stuck is, am I supposed to subclass string in a metaclass, and create my class with that meta, or subclass str directly? And also, I guess I need to implement __new__() somehow, because, my custom methods will modify my string object, and will return new mystr obj. My class's methods, should be completely chainable with str methods, and should always return a new my class instance when custom methods modified it. I want to be able to do something like this: a = mystr(