3 ms·
Personally, I'd really like to see an equivalent in Python to Haskell's `binop` , to turn an arbitrary two-argument function into a binary operator.
by JoshTriplett 13y ago
Personally, I'd really like to see an equivalent in Python to Haskell's `binop` , to turn an arbitrary two-argument function into a binary operator.
- JadeNB 13y agoI think that you're not alone, but this is specifically considered and rejected (in the section on "Rejected alternatives …"): > Add lots of new operators, or add a new generic syntax for defining infix operators: In addition to being generally un-Pythonic and repeatedly rejected by BDFL fiat, this would be using a sledgehammer to smash a fly.
- JoshTriplett 13y agoAnyone have a reference for where that in particular was rejected by BDFL fiat?
- takluyver 13y agoPEP 225 was an attempt to add a load of new operators that was rejected (well, deferred 14 years ago). I don't know of a proposal to define arbitrary binary operators.