[Python-ideas] π = math.pi

Guido van Rossum guido at python.org
Fri Jun 2 20:31:05 EDT 2017


OK, I think this discussion is pretty much dead then. We definitely
shouldn't allow math operators in identifiers, otherwise in Python 4 or 5
we couldn't introduce them as operators.

On Fri, Jun 2, 2017 at 5:10 PM, Steven D'Aprano <steve at pearwood.info> wrote:

> On Fri, Jun 02, 2017 at 04:29:16PM -0700, Guido van Rossum wrote:
>
> > Are those characters not considered Unicode letters? Maybe we could add
> > their category to the allowed set?
>
> They're not letters:
>
> py> {unicodedata.category(c) for c in '∑√∫∞'}
> {'Sm'}
>
>
> That's Symbol, Math.
>
> One problem is that the 'Sm' category includes a whole lot of
> mathematical symbols that we probably don't want in identifiers:
>
> ∴ ∣ ≈ ≒ ≝ ≫ ≮ ⊞  (plus MANY more variations on = < and > operators)
>
> including some "Confusables":
>
> ∁ ∊ ∨ ∗ ∑ etc
>
> C ε v * Σ
>
> http://www.unicode.org/reports/tr39/
>
> Of course a language can define identifiers however it likes, but I
> think it is relevant that the Unicode Consortium's default algorithm for
> determining an identifier excludes Sm.
>
> http://www.unicode.org/reports/tr31/
>
> I also disagree with Ivan that these symbols would be particularly
> useful in general, even for maths-heavy code, although I wouldn't say no
> to special casing ∞ (infinity) and maybe √ as a unary square root
> operator.
>
>
>
> --
> Steve
> _______________________________________________
> 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/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170602/eba3a9f3/attachment.html>


More information about the Python-ideas mailing list