[Python-ideas] π = math.pi

Matthias Bussonnier bussonniermatthias at gmail.com
Fri Jun 2 19:44:41 EDT 2017


> (Btw IPython just supports normal TeX notations like \pi, \lambda etc, so it is very easy to remember)

IPython dev here. I am the one who implemented (most of) that. We do
support it, but it's not easy to
remember unless you know how to write latex, and know said character.

Question, how would you type the following:

In [3]: ℸ = 1

Hint it's easy it's \CHARACTERNAME<tab>, but if you don't know how ℸ
is named[1], you are screwed[3].
It's cute, it's compact, it's extremely useful for some internal code,
but _exporting_ this as an interface is
IMHO an extremely bad idea that hinders readability[2] and usability
of the code.



On Fri, Jun 2, 2017 at 4:29 PM, Guido van Rossum <guido at python.org> wrote:
> Are those characters not considered Unicode letters? Maybe we could add
> their category to the allowed set?

+1 on allowing more of math symbols and be more flexible on allowed
identifiers though.
In particular the one mentioned above are part of mathematical operators[4].

It also would be great for some of these to be parsed as infix
operators, but that's another topic :-)

-- 
M

[1]  \daleth
[2] and that's assuming your font support said character.
[3] Tab completion on full unicode character name does work as well so
\GREEK SMALL LETTER GAMMA<tab> will give you γ. And \γ<tab> will
expand to \gamma, so you can figure it out, but users still struggle
for unknown symbols
[4] http://www.fileformat.info/info/unicode/block/mathematical_operators/images.htm

On Fri, Jun 2, 2017 at 4:02 PM, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:
> On 3 June 2017 at 00:55, Guido van Rossum <guido at python.org> wrote:
>>
>> [...]
>> So, I am still in favor of the rule "only ASCII in the stdlib".
>
>
> But what about the other question? Currently, integral, sum, infinity,
> square root etc. Unicode symbols are all prohibited in identifiers.
> Is it possible to allow them?
>
> (Btw IPython just supports normal TeX notations like \pi, \lambda etc, so it
> is very easy to remember)
>
> --
> Ivan
>
>
>
> _______________________________________________
> 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