title: Can you monkey patch methods on core types in Python?
body: <p>Ruby can add methods to the Number class and other core types to get effects like this:</p>
  <pre class="lang-rb prettyprint-override"><code>1.should_equal(1)
  </code></pre>
  <p>But it seems like Python cannot do this. Is this true? And if so, why? Does it have something to do with the fact that <em>type</em> can't be modified?</p>
  <p><em>Rather than talking about different definitions of monkey patching, I would like to just focus on the example above. I have already concluded that it cannot be done as a few of you have answered. But I would like a more detailed explanation of why it cannot be done, and maybe what feature, if available in Python, would allow this.</em></p>
  <p>To answer some of you: The reason I <em>might</em> want to do this is simply aesthetics/readability.</p>
  <pre><code> item.price.should_equal(19.99)
  </code></pre>
  <p>This reads more like English and clearly indicates which is the tested value and which is the expected value, as supposed to:</p>
  <pre><code>should_equal(item.price, 19.99)
  </code></pre>
  <p>This concept is what <a href="http://rspec.info/" rel="nofollow noreferrer">Rspec</a> and some other Ruby frameworks are based on.</p>