Custom operator

Diez B. Roggisch nospam-deets at web.de
Fri Feb 6 05:51:02 EST 2004


mathias.foehr at mails.lu wrote:

> I want to define new operators because mathematicians use special
> operators (
>          eg circle plus (+), circle times (*), arrows ->
> ) since centuries. It increases readability in this area and people have
> got used to it.

Then I suggest you wait until we from the tu berlin finish opal 2 - a
functional programming language which features declaration not only of
infix-operators, but even mix-fixes like

_ [ _ ]

for element access and the like. You can also specify operator precedence
and associativity.

In the already existing Opal btw. you can already create arbitrary
infix-ops, but afaik you need to use parentheses to eliminate ambiguities.

> By the way, are there hooks in python to preprocess a statement before the
> python compiler
> takes care of it?

Not that I know of - but I'm not expert on this. A few weeks ago somebody
announced that he was working on lisp-style makros - maybe he found a way.
Search google.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list