[Python-ideas] User-defined literals

Ryan Gonzalez rymg19 at gmail.com
Sat Jun 6 02:50:56 CEST 2015



On June 5, 2015 7:28:32 PM CDT, Guido van Rossum <guido at python.org> wrote:
>On Thu, Jun 4, 2015 at 4:20 PM, Andrew Barnert <abarnert at yahoo.com>
>wrote:
>
>> On Jun 4, 2015, at 14:05, Guido van Rossum <guido at python.org> wrote:
>>
>> OK, you can attribute that to lousy docs. The intention is that
>builtin
>> types are immutable.
>>
>>
>> I can go file bugs against those other implementations, but first,
>what's
>> the rationale?
>>
>> 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.
>From
>> the numbers discussion, it sounds like this was the only reason to
>reject
>> the idea of just patching float.__bases__.
>>
>> 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.
>>
>> "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.
>>
>
>Why do you need a better rationale?
>
>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.

Like javascript:void hacks to avoid undefined being re-defined.


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


More information about the Python-ideas mailing list