This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: including elementary mathematical functions in default types
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Michael.Gilbert, belopolsky, eric.smith, lemburg, mark.dickinson, rhettinger, stutzbach
Priority: normal Keywords:

Created on 2010-09-20 20:04 by Michael.Gilbert, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg116966 - (view) Author: Michael Gilbert (Michael.Gilbert) Date: 2010-09-20 20:04
hi,

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 builtin to the default float and complex types.  of course if those libs were removed, that would cause a lot of backward compatibility breakage.

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 functionality.

anyway, just a thought.

[0] http://docs.python.org/reference/datamodel.html
msg117053 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-09-21 14:43
IIRC, trigonometric functions, such as sin or cos, are not considered "elementary" in the real domain.

The problem with this proposal is where to stop.  Right now the line is drawn somewhere at __abs__ and __pow__.  If you add __sin__ and __cos__, you would probably want to include __tan__ and the inverses to all three of sin, cos and tan.  What about hyperbolic functions: sinh, cosh, tanh, etc?  These are actually "elementary" in the usual sense.

-1 and the proper forum for such suggestions in python-ideas rather then the bug tracker.
msg117057 - (view) Author: Michael Gilbert (Michael.Gilbert) Date: 2010-09-21 14:58
the  elementary functions are well-defined set, and i would include all of them.  that includes exp, sqrt, ln, trig, and hyperbolic functions.

i'll start a thread on python-ideas.  thanks.
History
Date User Action Args
2022-04-11 14:57:06adminsetgithub: 54115
2010-09-21 19:14:59rhettingersetstatus: open -> closed
resolution: not a bug
2010-09-21 14:58:41Michael.Gilbertsetmessages: + msg117057
2010-09-21 14:43:57belopolskysetnosy: + belopolsky
messages: + msg117053
2010-09-20 22:16:07eric.araujosetnosy: + lemburg, rhettinger, mark.dickinson, eric.smith, stutzbach

type: enhancement
versions: - Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.3
2010-09-20 20:04:59Michael.Gilbertcreate