[Python-ideas] User-defined literals

Chris Angelico rosuav at gmail.com
Thu Jun 4 23:45:39 CEST 2015


On Fri, Jun 5, 2015 at 7:34 AM,  <random832 at fastmail.us> wrote:
> On Thu, Jun 4, 2015, at 17:23, Chris Angelico wrote:
>> Huh. Does that imply that Brython has to construct a brand-new integer
>> object for absolutely every operation and constant, in case someone
>> monkeypatched something? Once integers (and other built-in types) lose
>> their immutability, they become distinguishable:
>>
>> x = 2
>> monkey_patch(x)
>> y = 2
>
> Er, we're talking about monkey-patching the int *class* (well, the
> complex class, but the same idea applies), not an individual int object.

Ah okay. Even so, it would be very surprising if "1+2" could evaluate
to anything other than 3.

ChrisA


More information about the Python-ideas mailing list