title: How to operate on a string while keep track of each char's score?
body: <h2>Problem</h2>
  
  <p>I have a string and scores for each char in the string</p>
  
  <pre><code>text = 'text'
  scores = [0.99, 0.98, 0.97, 0.96]
  </code></pre>
  
  <p>I would like to do many string operations to <code>text</code>, like <code>re</code>, <code>+</code>, <code>slice</code> or <code>split</code>, after do these operations, I want to keep correspond scores. For example, if I do a slice operation I want get <code>sliced_text</code> and <code>sliced_scores</code> as result:</p>
  
  <pre><code>sliced_text = text[0:2]
  sliced_scores = scores[0:2]
  </code></pre>
  
  <p>Python3 has <code>UserString</code> class, for some simple operations like <code>slice</code> or <code>add</code>, it's very useful.</p>
  
  <pre><code>from collections import UserString
  
  from typing import List
  
  
  class ScoreString(UserString):
      def __init__(self, text: str, scores: List[float]):
          super().__init__(text)
          assert len(text) == len(scores)
          self.scores = scores
  
      def __getitem__(self, index) -&gt; 'ScoreString':
          return self.__class__(self.data[index], self.scores[index])
  
      def __add__(self, other) -&gt; 'ScoreString':
          return self.__class__(self.data + other.data, self.scores + other.scores)
  
  score_str = ScoreString('Test123', [1, 2, 3, 4, 5, 6, 7])
  a = score_str[0:2] + score_str[4:]
  print(a.data) # Te123
  print(a.scores) # [1, 2, 5, 6, 7]
  </code></pre>
  
  <p>But <code>split</code> or <code>re</code> not work.</p>
  
  <pre><code>print(score_str.split('12')) # return string list ['Test', '3'], lose scores
  
  import re
  re.sub('123', '', score_str) # TypeError: expected string or bytes-like object
  </code></pre>
  
  <p>Any suggestion?</p>