[Python-ideas] π = math.pi

David Mertz mertz at gnosis.cx
Sat Jun 3 02:50:05 EDT 2017


This is a horrible thing that nobody else should do :-), but I *am* the
author of the file linked by Pavol.  It's based on someone else's version
(credited in the file), but I fine tuned it for what I want.  I'm also not
the author of the conceal plugin for vim, which is pretty much exactly for
just this.

The screenshot attached is a little bit of a vim session editing a Python
file.  The key thing is that I *type* only regular ASCII characters; I just
tell vim to show my something different on lines I am not currently editing.

On Fri, Jun 2, 2017 at 11:26 PM, Pavol Lisy <pavol.lisy at gmail.com> wrote:

> 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
> )
> _______________________________________________
> 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/
>



-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170602/fbad4522/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: conceal.png
Type: image/png
Size: 165902 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170602/fbad4522/attachment-0001.png>


More information about the Python-ideas mailing list