We could treat it as a kind of future statement. If there’s a top level
statement that defines the magic identitier we generate the special
bytecode.

On Wed, Dec 4, 2019 at 12:26 Brett Cannon <br...@python.org> wrote:

>
>
> On Tue, Dec 3, 2019 at 5:58 PM Random832 <random...@fastmail.com> wrote:
>
>> On Tue, Dec 3, 2019, at 13:43, Brett Cannon wrote:
>> > -1 from me. I can see someone not realizing an operator was changed,
>> > assuming it's standard semantics, and then having things break subtly.
>> > And debugging this wouldn't be fun either. To me this is monkeypatching
>> > without an explicit need for it, i.e. if you really want different
>> > semantics in your module then define a function and use that instead of
>> > influence-at-a-distance overriding of syntax.
>>
>> Does it make a difference that it'd only apply to code that is physically
>> in the same module where the function is defined? I'd originally planned to
>> suggest full lexical scope for the lookup, in fact, so you could in theory
>> do it within a single function.
>>
>
> Not enough to change my opinion. Changing how fundamental operators work
> just in a module is still influencing too far from the code site. For
> instance, if I navigate in my editor directly into the middle of a file or
> open a file and immediately start searching for the function I care about I
> won't notice that "+" no longer means what I thought it meant for integers
> because someone thought it would be smart to redefine that.
>
> And as Serhiy pointed out, performance is going to get slammed by this, no
> opcode or not as you just introduced a new lookup on every syntactic
> operation.
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/DXZO7UVMBXMV7KNBPZU25YA3PQLUI4NF/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-- 
--Guido (mobile)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/O7HUPYUCMNFRO36FOMWTS7HNY6WXNK2K/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to