[Python-ideas] π = math.pi

Stephan Houben stephanh42 at gmail.com
Thu Jun 1 03:30:28 EDT 2017


Or perhaps create a small module:

============unimath.py==============
import math

__all__ = ["π", "τ", "Γ"]

π = math.pi
τ = math.tau
Γ = math.gamma
====================================

Then do:
from unimath import *

Put it on the Python Package index.
If it gets wildly popular the case for putting it in `math` will be
greatly strengthened.

Stephan


2017-06-01 9:17 GMT+02:00 Brice PARENT <contact at brice.xyz>:
> Why not simply use
>
> from math import pi as π
>
> and so on? It makes your math formulas more readable (taking out the "math."
> entirely), without requiring any change to the module.
>
>
> Le 01/06/17 à 08:47, Serhiy Storchaka a écrit :
>
>> What you are think about adding Unicode aliases for some mathematic names
>> in the math module? ;-)
>>
>> math.π = math.pi
>> math.τ = math.tau
>> math.Γ = math.gamma
>> math.ℯ = math.e
>>
>> Unfortunately we can't use ∞, ∑ and √ as identifiers. :-(
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


More information about the Python-ideas mailing list