[Python-ideas] π = math.pi

Pavol Lisy pavol.lisy at gmail.com
Sat Jun 3 02:26:28 EDT 2017


On 6/1/17, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 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. :-(

My humble opinion: I would rather like to see something like:

    from some_wide_used_scientific_library.math_constants import *

with good acceptance from scientific users before thinking to add it
into stdlib.

PS.
Maybe this could be interesting for some vim users ->
http://gnosis.cx/bin/.vim/after/syntax/python.vim (I am not author of
this file)

If you apply it in vim then vim show lines (where is not cursor)
"translated". Means for example that math.pi is replaced by π.

So you still edit "math.pi" but if you move cursor outside of this
line then you could see formula simplified/prettified. (or more
complicated - because you need a little train your brain to accept new
view)

I am pretty skeptic how popular this conceal technique could be in vim
pythonistas community!

(
why skeptic?
For example I am testing to improve readability of line similar to

   self.a = self.b + self.c

using with this technique and see in vim

   ᐠa = ᐠb + ᐠc

but **I am not sure if it is really useful** (probably I have to add
that I am editing code much more in other editor than vim)

ᐠ U+1420 CANADIAN SYLLABICS FINAL GRAVE
)


More information about the Python-ideas mailing list