title: Python Hanging on Length and Split functions
body: <p>I have a bit of code and it is hanging when I run it. I have narrowed it down to the following line. When I remove this line, my code does not hang.</p>
  <p>However, there is nothing in this line which would make me think it could hang. There is no loops. Is there any known issues where string functions can hang given unknown input?</p>
  <p>Here is the line causing the problem:</p>
  <pre><code>len(body.split(&quot;\n&quot;)[-1]) &gt;= 67
  </code></pre>
  <p>Here is the full function. Notice I have commented things out trying to narrow this down:</p>
  <pre><code>    def __str__(self):
          body = &quot;&quot;
          for i in range(0, self.height):
              for j in range (0, self.width):
                  body += str(clamp(self.canvas[j][i]).red)
                  if len(body.split(&quot;\n&quot;)[-1]) &gt;= 67 and j != self.width - 1:
                      body += &quot;\n&quot;
                  else:
                      body += &quot; &quot;
                  #body += str(clamp(self.canvas[j][i]).green)
                  #if len(body.split(&quot;\n&quot;)[-1]) &gt;= 67 and j != self.width - 1:
                  #    body += &quot;\n&quot;
                  #else:
                  #    body += &quot; &quot;
                  #body += str(clamp(self.canvas[j][i]).blue)
                  #if len(body.split(&quot;\n&quot;)[-1]) &gt;= 67 and j != self.width - 1:
                  #    body += &quot;\n&quot;
                  #elif j != self.width - 1:
                  #    body += &quot; &quot;
              if i != self.height - 1:
                  body += &quot;\n&quot;
          return body
  </code></pre>