Operator symbol for "nb_intdivide"
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Thu Jul 26 15:03:21 EDT 2001
Thu, 26 Jul 2001 18:08:34 GMT, Peter Dobcsanyi <petrus at pobox.com> pisze:
> But, I don't like the "//" operator symbol what we are supposed to
> use for implementing "a // b == floor(a/b)".
Me too.
> I would like to suggest to use a clearly distinguishable
> one-character symbol for the "nb_intdivide".
Here I disagree. I would preferably use div (and mod) as operators.
The only problem with them is that someone could have used them as
identifiers.
I still think that it's a minor problem, more easily fixed than
finding / which need to be changed at all. I still prefer it.
Perhaps because I used to use Pascal a lot. It's readable and is
already used in Python for other operators.
Other proposals:
- div (and mod) as functions, i.e. div(a, b). Ugly but the meaning
is clear.
- A general mechanism of turning functions into binary operators,
probably $div like in Miranda. This doesn't steal a keyword but
is inconsistent with spelling of existing operators (I don't know
about Miranda, but in Haskell there are no operators consisting
of letters).
- Some language uses \ (I don't remember which, probably a kind of
Basic or JavaScript). It is overloaded in Python, but not in the
middle of a line. Drawback: can't be used at the end of a line, i.e.
x = (2 \
3)
doesn't mean what you might think - this would be legal for + for
example because it's in parens.
And BTW, I still think that 1/3 is a rational.
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK
More information about the Python-list
mailing list