Jp Calderone <[EMAIL PROTECTED]> writes: > On Wed, 29 Dec 2004 11:42:00 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >>[EMAIL PROTECTED] writes: >> >> > @infix >> > def interval(x, y): return range(x, y+1) # 2 parameters needed >> > >> > This may allow: >> > assert 5 interval 9 == interval(5,9) >> >> I don't like the idea of turning words into operators. I'd much rather >> see something like: > > Really? I like "not", "and", "or", "is", and "in". It would not be nice > if they were replaced with punctuation.
They can't be turned into operators - they already are. > This aside, not even Python 3.0 will be flexible enough to let you define > an infix decorator. The language developers are strongly against supporting > macros, which is what an infix decorator would amount to. Could you please explain how allowing new infix operators amount to supporting macros? > Now, they might be convinced to add a new syntax that makes a function > into an infix operator. Perhaps something like this: > > def &(..)(x, y): > return range(x, y + 1) And while you're at it, explain how this method of defining new infix operators differs from using decorators in such a way that it doesn't amount to supporting macros. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list