[Python-ideas] Is there a good reason to use * for multiplication?

Yuval Greenfield ubershmekel at gmail.com
Sat Oct 13 10:05:34 CEST 2012


On Oct 13, 2012 6:45 AM, "Devin Jeanpierre" <jeanpierreda at gmail.com> wrote:
>
> On Fri, Oct 12, 2012 at 10:41 PM, Steven D'Aprano <steve at pearwood.info>
wrote:
> > If I were designing a language from scratch today, with full Unicode
support
> > from the beginning, I would support a rich set of operators possibly
even
> > including MIDDLE DOT and × MULTIPLICATION SIGN, and leave it up to the
user
> > to use them wisely or not at all. But I don't think it would be
appropriate
> > for Python to add them, at least not before Python 4: too much effort
for
> > too
> > little gain. Maybe in another ten years people will be less resistant to
> > Unicode operators.
>
> Python has cleverly left the $ symbol unused.
>
> We can use it as a quasiquote to embed executable TeX.
>
>     for x in xrange($b \cdot \sum_{i=1}^n \frac{x^n}{n!}$):
>         ...
>

I hope this was in jest because that line of TeX for general programming
made my eyes bleed.

A PEP for defining operators sounds interesting for 4.0 indeed. Though it
might be messy to allow a module to meddle with the python syntax.

Perhaps instead I would like it if all operators were objects with e.g.
special __infix__ methods.

Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121013/fc10aa27/attachment.html>


More information about the Python-ideas mailing list