I’m looking into overloading the + operator for a certain string so I was thinking of subclassing the string class then adding the code in the new class. However I wanted to take a look at the standard string class first but I can’t seem to find it… stupid eh?
Can anyone point the way? Even online documentation of the source code.
It’s documented here. The main implementation is in
Objects/stringobject.c. Subclassingstrprobably isn’t what you want, though. I would tend to prefer composition here; have an object with a string field, and special behavior.