<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 4, 2015 at 4:20 PM, Andrew Barnert <span dir="ltr"><<a href="mailto:abarnert@yahoo.com" target="_blank">abarnert@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div>On Jun 4, 2015, at 14:05, Guido van Rossum <<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="ltr">OK, you can attribute that to lousy docs. The intention is that builtin types are immutable.<br></div></div></blockquote><div><br></div></span><div>I can go file bugs against those other implementations, but first, what's the rationale?</div><div><br></div><div>The ABC PEP, the numbers PEP discussion, and the type/class unification tutorial all use the same reason: In CPython, different interpreters in the same memory space (as with mod_python) share the same built-in types.<span style="background-color:rgba(255,255,255,0)"> From the numbers discussion, it sounds like this was the only reason to reject the idea of just patching float.__bases__.</span></div><div><br></div><div>But most other Python implementations don't have process-wide globals like that to worry about; patching int in one interpreter can't possibly affect any other interpreter.</div><div><br></div><div>"Because CPython can't do it, nobody else should do it, to keep code portable" might be a good enough rationale for something this fundamental, but if that's not the one you're thinking of, I don't want to put those words in your mouth.</div></div></blockquote><div><br></div><div>Why do you need a better rationale?<br><br>The builtins are shared between all modules in a way that other things aren't. Nothing good can come from officially recognizing the ability to monkey-patch the builtin types -- it would just lead to paranoia amongst library developers.<br><br></div></div>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>