[Python-Dev] Integer division transition
Charles G Waldman
Tue, 7 Nov 2000 10:30:16 -0600 (CST)
> Guido van Rossum:
> > No, we *could* use the 'import as' trick: define the syntax as
> > term: factor (('*'|'/'|'%'|NAME) factor)*
> > and add a check that NAME is "div" in the compiler.
> > But I don't know how comfy I am with a proliferation of hacks like
> > this -- and it's likely to cause more confusing error messages.
And what is the compelling reason for going through all this instead
of just using the '//' symbol? Because it might be confused for a C++
comment? This is a weak argument AFAIAC. Python is not C++ and
everybody knows that.
I think that making "div" an infix operator would be setting a
horrible precedent. Currently, all infix operators "look like"
operators, i.e. they are non-alphabetic characters, and things that
look like words are either functions or reserved words.
There's already a "divmod" builtin which is a function, not an infix
operator. I think it would be rather inconsistent to write, on the
and on the other:
10 div 2
Long before the creation of python-dev, this issue had been discussed
numerous times on c.l.py, and the '//' operator was suggested several
times, and I don't think anybody ever had a problem with it...