[Python-ideas] Including elementary mathematical functions in the python data model

Michael Gilbert michael.s.gilbert at gmail.com
Tue Sep 21 20:44:52 CEST 2010


It would be really nice if elementary mathematical operations such as
sin/cosine (via __sin__ and __cos__) were available as base parts of
the python data model [0].  This would make it easier to write new math
classes, and it would eliminate the ugliness of things like self.exp().

This would also eliminate the need for separate math and cmath
libraries since those could be built into the default float and complex
types.  Of course if those libs were removed, that would be a potential
backwards compatibility issue.

It would also help new users who just want to do math and don't know
that they need to import separate classes just for elementary math

I think full coverage of the elementary function set would be the goal
(i.e. exp, sqrt, ln, trig, and hyperbolic functions).  This would not
include special functions since that would be overkill, and they are
already handled well by scipy and numpy.

Anyway, just a thought.

Best wishes,

[0] http://docs.python.org/reference/datamodel.html

More information about the Python-ideas mailing list