Andrew Barnert <[email protected]> writes:

>> On Feb 2, 2020, at 07:18, Karl Ramm <[email protected]> wrote:
>> 
>> 
>> I propose adding ! and $ as (normally unimplemented) binary operators and ?
>> as a unary operator so as to explicitly to give people the rope they want
>> but clearly tagged "here there be shenanigans".
>
> Why should ? be a prefix operator and the other two infix? Especially
> given that those aren’t their syntax in other common languages (! is
> usually prefix, ? is usually suffix or infix or part of a ternary
> infix…):

I figured there should be at least one unary operator, and I wanted the one
character that essentially never is.


> What precedence do they have? What associativity? Do the infix ones
> follow __rop__ protocols like arithmetic operators, different rules
> like comparisons, or no reverse overloading?

Since I was assuming they'd act like arithmetic operators, one of the
binary operators being high priority and the other being low.  No strong
feelings as to which one, because the details are sort of beside the point.

> Why these three and not backticks or tildes or Unicode symbols?

Because ~ is already bitwise inversion, I have a more interesting idea
for backtick, and I do think all of our operators should be consistently
typable on a standard keyboard layout.

> I think in order to actually be useful for people who want this
> flexibility all of that may need to be configurable.

This is more rope for people who will go tie themselves up with it and leave
the rest of us alone; it's not actually necessary for anything.

> At which point you might as well go full Haskell and allow people to
> define any string of symbol characters as a new operator.

I do think that the people who actually use these should actually go write
haskell instead.

> But I think the fact that code
> written with custom operators wouldn’t feel much like Python is a

Arbitrary operators, in which case agreed (if I want Haskell I know where
to find it) or just the leftover punctuation, in which case I _disagree_
because these would mark code as explicitly weird.

I've mostly been dragging this idea around in my head for a while and
wanted to get it out and see if anyone else was caught by it; it does seem
to be going over like a lead ballon.

kcr
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/Q32O2E73W3DZTSERLH5GJIGKIYIOI3BG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to