degrees and radians.

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Thu Sep 8 04:14:50 EDT 2016


On Tuesday, May 7, 2002 at 9:15:50 AM UTC+12, Fernando Pérez wrote:
> Plus, if you really need those conversions, it's less typing and more 
> efficient (no function call) to simply use a multiplicative constant...

This I have found to be the best idea. In Qahirah <https://github.com/ldo/qahirah> I provided “deg” and “circle” constants, used like this:

    ldo at hypatia:~> python3 -ic "import math, qahirah as qah"
    >>> math.sin(45 * qah.deg)
    0.7071067811865475
    >>> math.atan(1) / qah.deg
    45.0
    >>> math.cos(qah.circle / 4)
    6.123233995736766e-17

I think these provide greater flexibility than having to have explicit conversion functions.



More information about the Python-list mailing list