[Python-ideas] π = math.pi

Stephan Houben stephanh42 at gmail.com
Sat Jun 3 03:10:21 EDT 2017


I use the conceal feature for this purpose,
but I use

https://github.com/ehamberg/vim-cute-python

instead, which is a more toned-down version of the same idea.

I personally find
  x ≤ y, a ∉ B
more readable than
  x <= y, a not in B
etc.

Especially the conceal
lambda => λ
is useful for de-cluttering the code.

Stephan

2017-06-03 8:50 GMT+02:00 David Mertz <mertz at gnosis.cx>:
> 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.
>
> _______________________________________________
> 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