Adding new math operators

Jeff Petkau jpet at eskimo.com
Fri Aug 4 01:56:31 EDT 2000


Huaiyu Zhu <huaiyu_zhu at yahoo.com> wrote in message
news:Pine.LNX.4.10.10008030247030.3900-100000 at localhost.localdomain...
> 1.  New operators ~+ ~- ~* ~/ ~** ~+= ~-= ~*= ~/= ~**= are added to core
>     Python.  They parallel the existing operators + - * / ** and the (soon
>     to be added) += -= *= /= **= operators.
...
> Examples:
>      b = a.I ~- a.I ~* u ~/ (c.I ~+ v~/a~*u) ~* v ~/ a
>      z = sin(x~**2 ~+ y~**2)

Gah. As much as I wish for more operators sometimes, I
think this would have the Perl folks laughing at us for
programming in line noise. And given how much discussion
and thought went into this proposal, I'm not sure it's possible
to do any better as long as you're restricted to ASCII.

And now for something completely different:

What if there were no new operators, no new syntax, but
instead a new module that used excessive cleverness to
translate Python expressions into MathML, which was
then displayed in emacs/Idle/PythonWin as Real Math?

So you'd still enter expressions in function notation:
    dot(cross(v1,v2),solve(thingy,frob))

But when reading the code, you'd see a nice clean expression,
with parentheses sized and balanced and oh-so-easy to read.

Good idea or is it the Guinness talking?

--Jeff






More information about the Python-list mailing list