Sorry for probably stupid question! Is something like -> class A: def __oper__(self, '⊞', other): return something(self.value, other)
a = A() a ⊞ 3 thinkable? On 6/3/17, Guido van Rossum <gu...@python.org> wrote: > 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 <st...@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@python.org >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > > > > -- > --Guido van Rossum (python.org/~guido) > _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/