Steve Holden <[EMAIL PROTECTED]> writes: > Mike Meyer 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: >> @infix('..') >> def interval(x, y): >> return range(x, y + 1) >> assert 5 .. 9 == interval(5, 10) >> This would also allow us to start working on doing away with the >> magic >> method names for current operators, which I think would be an >> improvement. >> > Well, perhaps you can explain how a change that's made at run time > (calling the decorator) can affect the parser's compile time behavior, > then. At the moment, IIRC, the only way Python code can affect the > parser's behavior is in the __future__ module, which must be imported > at the very head of a module.
By modifying the parsers grammer at runtime. After all, it's just a data structure that's internal to the compiler. <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