[Python-ideas] new operators via backquoting

George Sakkis george.sakkis at gmail.com
Wed Jan 3 18:29:55 CET 2007


Chris Rebert wrote:

> In Haskell,  foo `baz` bar  means  (baz foo bar), which translates to
> baz(foo, bar) in Python. This allows Haskell programmers to use
> functions as infix operators.
> If I recall correctly, in Py3k, enclosing something in backticks will no
> longer cause it to be repr()-ed, leaving the backtick without a meaning
> in Python.

Perhaps you're not aware of the "best hack of 2005", which works in
current Python and goes a step further by allowing you to even
"override" the operator's delimiter:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122

George



More information about the Python-ideas mailing list